@@ -119,27 +119,26 @@ def status(self):
119119 atag = atag [:- 1 ]
120120 if atag == self .fxtag :
121121 break
122-
123122
124- #print(f"line is {line} ahash is {ahash} atag is {atag} {parts}")
125- # atag = git.git_operation("describe", "--tags", "--always")
126- # ahash = git.git_operation("rev-list", "HEAD").partition("\n")[0]
127-
128123 recurse = False
129124 if rurl != self .url :
130125 remote = self ._add_remote (git )
131126 git .git_operation ("fetch" , remote )
127+ # Asked for a tag and found that tag
132128 if self .fxtag and atag == self .fxtag :
133129 result = f" { self .name :>20} at tag { self .fxtag } "
134130 recurse = True
135131 testfails = False
132+ # Asked for and found a hash
136133 elif self .fxtag and (ahash [: len (self .fxtag )] == self .fxtag or (self .fxtag .find (ahash )== 0 )):
137134 result = f" { self .name :>20} at hash { ahash } "
138135 recurse = True
139136 testfails = False
137+ # Asked for and found a hash
140138 elif atag == ahash :
141139 result = f" { self .name :>20} at hash { ahash } "
142140 recurse = True
141+ # Did not find requested tag or hash
143142 elif self .fxtag :
144143 result = f"s { self .name :>20} { atag } { ahash } is out of sync with .gitmodules { self .fxtag } "
145144 testfails = True
@@ -396,13 +395,19 @@ async def update(self):
396395 smgit = GitInterface (repodir , self .logger )
397396 newremote = self ._add_remote (smgit )
398397 # Trying to distingush a tag from a hash
399- allowed = set (string .digits + 'abcdef' )
398+ allowed = set (string .digits + 'abcdef' )
399+ status = 0
400400 if not set (self .fxtag ) <= allowed :
401401 # This is a tag
402402 tag = f"refs/tags/{ self .fxtag } :refs/tags/{ self .fxtag } "
403- smgit .git_operation ("fetch" , newremote , tag )
404- smgit .git_operation ("checkout" , self .fxtag )
405-
403+ status ,_ = smgit .git_operation ("fetch" , newremote , tag )
404+ if status == 0 :
405+ status ,_ = smgit .git_operation ("checkout" , self .fxtag )
406+ if status :
407+ utils .fatal_error (
408+ f"Failed to checkout { self .name } at tag or hash { self .fxtag } from { repodir } "
409+ )
410+
406411 if not os .path .exists (os .path .join (repodir , ".git" )):
407412 utils .fatal_error (
408413 f"Failed to checkout { self .name } { repo_exists } { repodir } { self .path } "
0 commit comments