Skip to content

Commit a338ade

Browse files
committed
re #1059 Detecting git dir instead of hardcoded
1 parent d2b19b4 commit a338ade

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Utilities/SetupForDevelopment.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ git config branch.master.rebase true
4242
# display of changes merged in the fast-forward operation.
4343
git config rebase.stat true
4444

45+
gitDir=`git rev-parse --git-dir`
46+
4547
setup_user() {
4648
read -ep "Please enter your full name, such as 'John Doe': " name
4749
echo "Setting name to '$name'"
@@ -51,10 +53,11 @@ setup_user() {
5153
git config user.email "$email"
5254
}
5355

56+
# Copy hooks
57+
echo cp hooks/commit-msg $gitDir/hooks
58+
cp hooks/commit-msg $gitDir/hooks
59+
5460
if [ "$1" == "copyOnly" ]; then
55-
# Copy hooks
56-
echo cp hooks/commit-msg .git/hooks
57-
cp hooks/commit-msg .git/hooks
5861
exit 0
5962
fi
6063

@@ -83,8 +86,7 @@ else
8386
fi
8487
done
8588

86-
8789
# Record the version of this setup so the developer can be notified that
8890
# this script and/or hooks have been modified.
8991
SetupForDevelopment_VERSION=1
90-
git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION}
92+
git config hooks.SetupForDevelopment ${SetupForDevelopment_VERSION}

0 commit comments

Comments
 (0)