Merge pull request #2402 from nh2/fix-gistatus-for-detached-head-no-tags

gistatus: Fix hash not being shown when in detaced HEAD and there are…
This commit is contained in:
Anthony Scopatz 2017-06-19 16:03:28 -07:00 committed by GitHub
commit 476ab1ba44
2 changed files with 16 additions and 4 deletions

View file

@ -0,0 +1,13 @@
**Added:** None
**Changed:** None
**Deprecated:** None
**Removed:** None
**Fixed:**
* gistatus: Fixed hash not being shown when in detaced HEAD and there are no tags
**Security:** None

View file

@ -70,11 +70,10 @@ def _get_def(key):
def _get_tag_or_hash():
tag = _check_output(['git', 'describe', '--exact-match']).strip()
if tag:
return tag
tag_or_hash = _check_output(['git', 'describe', '--always']).strip()
hash_ = _check_output(['git', 'rev-parse', '--short', 'HEAD']).strip()
return _get_def('HASH') + hash_
have_tag_name = tag_or_hash != hash_
return tag_or_hash if have_tag_name else _get_def('HASH') + hash_
def _get_stash(gitdir):