From 98e2b3f4df0475987c271e66b84862dcc410b95f Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 15 Jul 2012 13:56:33 +0100 Subject: git-testament: Cope with detached HEAD better --- utils/git-testament.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'utils/git-testament.pl') diff --git a/utils/git-testament.pl b/utils/git-testament.pl index dc6301b50..89c41ab5e 100644 --- a/utils/git-testament.pl +++ b/utils/git-testament.pl @@ -68,7 +68,7 @@ if ( $git_present ) { chomp $gitinfo{url}; $gitinfo{revision} = `git rev-parse HEAD`; chomp $gitinfo{revision}; - $gitinfo{branch} = `git for-each-ref --format="\%(refname:short)" \$(git symbolic-ref HEAD)`; + $gitinfo{branch} = `git for-each-ref --format="\%(refname:short)" \$(git symbolic-ref HEAD 2>/dev/null || git show-ref -s HEAD)`; chomp $gitinfo{branch}; @bits = split /\s+/, `git describe --tags --exact-match HEAD 2>/dev/null`; $bits[0] = "" unless exists $bits[0]; -- cgit v1.2.3