From dea9adc440b0c014a0727e803b3a8663e1929a6c Mon Sep 17 00:00:00 2001 From: William Boman Date: Thu, 19 Feb 2015 05:54:50 +0100 Subject: [PATCH] Add feedback output to git hook init script. --- package.json | 3 ++- scripts/init-git-post-commit | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index eb54986..bb35516 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ }, "author": "Ionică Bizău ", "contributors": [ - "Gnab " + "Gnab ", + "William Boman " ], "license": "MIT", "devDependencies": {}, diff --git a/scripts/init-git-post-commit b/scripts/init-git-post-commit index ebf3d9e..6c3b416 100755 --- a/scripts/init-git-post-commit +++ b/scripts/init-git-post-commit @@ -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