Skip installing .revision-hash if not running make install from a git checkout

Check --show-prefix rather than --is-inside-work-tree in case we're
inside some other git repository (e.g. a ports tree).
This commit is contained in:
Matthew Martin 2020-04-10 09:09:12 -05:00
commit 2160c2d114
3 changed files with 14 additions and 11 deletions

View file

@ -18,11 +18,9 @@ install: all
cp .version zsh-syntax-highlighting.zsh $(SHARE_DIR)
cp COPYING.md README.md changelog.md $(DOC_DIR)
sed -e '1s/ .*//' -e '/^\[build-status-[a-z]*\]: /d' < README.md > $(DOC_DIR)/README.md
if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \
git rev-parse HEAD; \
else \
cat .revision-hash; \
fi > $(SHARE_DIR)/.revision-hash
if prefix=`git rev-parse --show-prefix 2>/dev/null` && [ x"$$prefix" = x ]; then \
git rev-parse HEAD > $(SHARE_DIR)/.revision-hash; \
fi
:
# The [ -e ] check below is to because sh evaluates this with (the moral
# equivalent of) NONOMATCH in effect, and highlighters/*.zsh has no matches.