mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-11-13 07:31:15 +01:00
Add feedback output to git hook init script.
This commit is contained in:
parent
0bd6180a0b
commit
dea9adc440
2 changed files with 14 additions and 4 deletions
|
@ -11,7 +11,8 @@
|
|||
},
|
||||
"author": "Ionică Bizău <bizauionica@gmail.com>",
|
||||
"contributors": [
|
||||
"Gnab <as0n@gnab.fr>"
|
||||
"Gnab <as0n@gnab.fr>",
|
||||
"William Boman <william@redwill.se>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {},
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Setting up git-stats hooks.";
|
||||
|
||||
git_templates_dir=$(git config --global --get init.templatedir);
|
||||
if [ $? -ne 0 ]; then
|
||||
# Create a new global templatedir if there are none
|
||||
|
@ -25,8 +27,15 @@ EOF
|
|||
);
|
||||
|
||||
if [ ! -f "$post_commit_path" ]; then
|
||||
printf "#!/bin/sh\n%s" "$hook" > "$post_commit_path"
|
||||
chmod +x "$post_commit_path"
|
||||
printf "#!/bin/sh\n%s" "$hook" > "$post_commit_path" \
|
||||
&& chmod +x "$post_commit_path" \
|
||||
&& echo "Successfully set up git-stats hook at ${post_commit_path}." \
|
||||
&& exit 0
|
||||
else
|
||||
printf "\n%s\n" "$hook" >> "$post_commit_path"
|
||||
printf "\n%s\n" "$hook" >> "$post_commit_path" \
|
||||
&& echo "Successfully set up git-stats hook at ${post_commit_path}." \
|
||||
&& exit 0
|
||||
fi
|
||||
|
||||
echo "Couldn't set up git-stats hook."
|
||||
exit 1
|
||||
|
|
Loading…
Reference in a new issue