diff options
-rwxr-xr-x | post-commit | 16 |
1 files 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 |