diff --git a/Makefile b/Makefile index 7a890d5..bb18c59 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,9 @@ install: if ! grep "$(COMMAND)" not_need_git_repo >/dev/null; then \ cat ./helper/is-git-repo >> $(TEMPFILE); \ fi; \ + if grep "$(COMMAND)" need_git_commit >/dev/null; then \ + cat ./helper/has-git-commit >> $(TEMPFILE); \ + fi; \ tail -n +2 bin/$(COMMAND) >> $(TEMPFILE); \ cp -f $(TEMPFILE) $(DESTDIR)$(BINPREFIX)/$(COMMAND); \ fi; \ diff --git a/helper/has-git-commit b/helper/has-git-commit new file mode 100644 index 0000000..0390663 --- /dev/null +++ b/helper/has-git-commit @@ -0,0 +1,14 @@ +# +# check whether current directory contains any git commit +# + +has_git_commit() { + git rev-parse --short HEAD > /dev/null 2>&1 + result=$? + if test $result != 0; then + >&2 echo 'Not git commit found!' + exit $result + fi +} + +has_git_commit diff --git a/need_git_commit b/need_git_commit new file mode 100644 index 0000000..c929566 --- /dev/null +++ b/need_git_commit @@ -0,0 +1,13 @@ +# A list of the commands that require has_git_commit(), and should have +# it included in the "built" version of the command +git-authors +git-back +git-changelog +git-commits-since +git-count +git-effort +git-local-commits +git-reauthor +git-stamp +git-summary +git-undo