From c0026af63ef38e27b67b1f5fc7ef656467b4b715 Mon Sep 17 00:00:00 2001 From: Marti Martz Date: Mon, 25 Apr 2016 04:53:03 -0600 Subject: [PATCH] Use `rev-parse` instead of `show-ref` (#1958) * Use `rev-parse` instead of `show-ref` * Dev builds currently use masters commit ref and makes it difficult to determine which version is really installed with About → Help. Use the current HEAD when generating the `Makefile`s for `DGIT_REVISION` **NOTES** * The bash scripts are somewhat duplicated with the unused `--short` parameter but omitted at this time in case a long hash is wanted. * `make distclean` is still needed since those defines are hard-coded into those affected `Makefile`s * Keep current abstract as per @nowrep * Remove some known unneeded bash pipes --- git_hooks/post-checkout | 2 +- git_hooks/post-commit | 2 +- git_hooks/post-merge | 2 +- scripts/getrevision.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/git_hooks/post-checkout b/git_hooks/post-checkout index 050a3b675..8c3664d93 100755 --- a/git_hooks/post-checkout +++ b/git_hooks/post-checkout @@ -2,4 +2,4 @@ # # Writes git revision into git_revision file # -git show-ref refs/heads/master | cut -d " " -f 1 > git_revision +git rev-parse HEAD > git_revision diff --git a/git_hooks/post-commit b/git_hooks/post-commit index 050a3b675..8c3664d93 100755 --- a/git_hooks/post-commit +++ b/git_hooks/post-commit @@ -2,4 +2,4 @@ # # Writes git revision into git_revision file # -git show-ref refs/heads/master | cut -d " " -f 1 > git_revision +git rev-parse HEAD > git_revision diff --git a/git_hooks/post-merge b/git_hooks/post-merge index 050a3b675..8c3664d93 100755 --- a/git_hooks/post-merge +++ b/git_hooks/post-merge @@ -2,4 +2,4 @@ # # Writes git revision into git_revision file # -git show-ref refs/heads/master | cut -d " " -f 1 > git_revision +git rev-parse HEAD > git_revision diff --git a/scripts/getrevision.sh b/scripts/getrevision.sh index 0246c4638..eb341c9e6 100755 --- a/scripts/getrevision.sh +++ b/scripts/getrevision.sh @@ -3,7 +3,7 @@ REV="" if [ -e "/usr/bin/git" ] && ([ -e ".git" ] || [ -e "../.git" ]); then - REV=`git show-ref refs/heads/master | cut -d " " -f 1` + REV=`git rev-parse HEAD` elif [ -e "git_revision" ]; then REV=`cat git_revision` fi