[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Git hooks
From: |
Tim Rice |
Subject: |
Re: Git hooks |
Date: |
Wed, 15 Jun 2022 20:52:10 +0000 |
Hey Shawn,
Any objections if I commit it?
Thanks for that. I agree with Erik about the "Unfortunately,". I also wonder if
the setup-hooks.sh could use a little `git rev-parse` something something to look for the
repo's .git. Like this:
```
gitdir="$(git rev-parse --git-dir)"
[[ $? -eq 0 ]] || {
printf "%s: No .git directory found.\n" "$0"
exit 1
}
ln -fs \
"$(git rev-parse --show-toplevel)/hooks/pre-commit.sh" \
"${gitdir}/hooks/pre-commit || \
...
```
Hopefully that will be more flexible/robust than assuming we're already in the
repo's root directory.
~ Tim