summaryrefslogtreecommitdiffstats
path: root/git-hooks/post-merge
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-05-21 20:02:29 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-22 12:02:13 +0200
commit975d551a8a1fbe41303c6774c5082917bfcba4b1 (patch)
treed1e7b5d9792ed613a817c1356bab379ccba2cf5b /git-hooks/post-merge
parentcbb4753419746f401afab89e8e8dfc7459bb1c8f (diff)
Handle fresh clones gracefully in post-merge hook
Diffstat (limited to 'git-hooks/post-merge')
-rwxr-xr-xgit-hooks/post-merge9
1 files changed, 6 insertions, 3 deletions
diff --git a/git-hooks/post-merge b/git-hooks/post-merge
index 9618b5e31..02583897f 100755
--- a/git-hooks/post-merge
+++ b/git-hooks/post-merge
@@ -6,10 +6,13 @@ fi
cd "$GIT_DIR/.."
-changes=$(git diff --name-only @{1})
+changes=$(git diff --name-only @{1} 2> /dev/null)
+fresh_clone=$?
# Exit if nothing has changed
-[[ -z "$changes" ]] && exit
+if [ ! $fresh_clone ] && [[ -z "$changes" ]]; then
+ exit
+fi
# Update databse
php index.php tools update_database
@@ -24,4 +27,4 @@ if [[ ! -f ./data/js/main.min.js ]]; then
fi
# Show changes to NEWS
-git diff @{1} NEWS | cat
+git diff @{1} NEWS 2> /dev/null | cat