mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
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:
commit
476ab1ba44
2 changed files with 16 additions and 4 deletions
13
news/fix-gistatus-for-detached-head-no-tags.rst
Normal file
13
news/fix-gistatus-for-detached-head-no-tags.rst
Normal 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
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue