From f49cd5f6a82f7bc1e9df9eead0a9e1e5b4d843bc Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 30 Sep 2016 19:01:54 -0400 Subject: post-commit: only stash if necessary --- post-commit | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/post-commit b/post-commit index 6abf27a..d3a81ba 100755 --- a/post-commit +++ b/post-commit @@ -2,15 +2,23 @@ branch=$(git name-rev --name-only HEAD) if [[ $branch == master ]]; then - git add . - git stash + + stash=false + if [[ -n "$(git status --porcelain)" ]]; then + stash=true + git add . + git stash + fi git checkout pre-generated git merge master -m 'bogus' make --always-make -j12 git add . git commit --amend -m "make: $(git log -n1 master --pretty=format:%B)" - git checkout master - git stash pop + + if $stash; then + git stash pop + fi + fi -- cgit v1.2.3