Skip to content

Commit

Permalink
Merge pull request #58 from ESMCI/fix/hashid
Browse files Browse the repository at this point in the history
fix hash id and tag parsing
  • Loading branch information
jedwards4b authored Jul 25, 2024
2 parents 36b4b92 + e705f72 commit 1ee334a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions git_fleximod/submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def status(self):
needsupdate = True
return result, needsupdate, localmods, testfails
rurl = git.git_operation("ls-remote","--get-url").rstrip()
line = git.git_operation("log", "--pretty=format:\"%h %d").partition('\n')[0]
line = git.git_operation("log", "--pretty=format:\"%h %d\"").partition('\n')[0]
parts = line.split()
ahash = parts[0][1:]
atag = None
Expand All @@ -112,12 +112,14 @@ def status(self):
while idx < len(parts)-1:
idx = idx+1
if parts[idx] == 'tag:':
atag = parts[idx+1][:-1]
atag = parts[idx+1]
while atag.endswith(')') or atag.endswith(',') or atag.endswith("\""):
atag = atag[:-1]
if atag == self.fxtag:
break


#print(f"line is {line} ahash is {ahash} atag is {atag}")
#print(f"line is {line} ahash is {ahash} atag is {atag} {parts}")
# atag = git.git_operation("describe", "--tags", "--always").rstrip()
# ahash = git.git_operation("rev-list", "HEAD").partition("\n")[0]

Expand All @@ -129,7 +131,7 @@ def status(self):
result = f" {self.name:>20} at tag {self.fxtag}"
recurse = True
testfails = False
elif self.fxtag and ahash[: len(self.fxtag)] == self.fxtag:
elif self.fxtag and (ahash[: len(self.fxtag)] == self.fxtag or (self.fxtag.find(ahash)==0)):
result = f" {self.name:>20} at hash {ahash}"
recurse = True
testfails = False
Expand Down

0 comments on commit 1ee334a

Please sign in to comment.