File tree 1 file changed +9
-1
lines changed
Filter options
1 file changed +9
-1
lines changed
Original file line number Diff line number Diff line change 25
25
# used in local dev releases
26
26
git_hash = subprocess .check_output (['git' , 'rev-parse' , '--short' , 'HEAD' ]).splitlines ()[0 ].decode ()
27
27
# this outputs the annotated tag if we are exactly on a tag, otherwise <tag>-<n>-g<shortened sha-1>
28
- tag = subprocess .check_output (['git' , 'describe' , '--tags' ]).splitlines ()[0 ].decode ().split ('-' )
28
+ try :
29
+ tag = subprocess .check_output (['git' , 'describe' , '--tags' ], stderr = subprocess .STDOUT ).splitlines ()[0 ].decode ().split ('-' )
30
+ except subprocess .CalledProcessError as e :
31
+ # no tags reachable (e.g. on a topic branch in a fork), see
32
+ # https://stackoverflow.com/questions/4916492/git-describe-fails-with-fatal-no-names-found-cannot-describe-anything
33
+ if e .output .rstrip () == b"fatal: No names found, cannot describe anything." :
34
+ tag = []
35
+ else :
36
+ print (e .output ); raise
29
37
30
38
if len (tag ) == 1 :
31
39
# tag identifies the build and should be a sequential revision number
You can’t perform that action at this time.
0 commit comments