@@ -16,9 +16,9 @@ def fetch_git_sha(path, head=None):
1616 head_path = os .path .join (path , '.git' , 'HEAD' )
1717 if not os .path .exists (head_path ):
1818 raise InvalidGitRepository (
19- 'Cannot identify HEAD for git repository at %s' % ( path ,) )
19+ f 'Cannot identify HEAD for git repository at { path } ' )
2020
21- with open (head_path , 'r' ) as fp :
21+ with open (head_path ) as fp :
2222 head = str (fp .read ()).strip ()
2323
2424 if head .startswith ('ref: ' ):
@@ -34,7 +34,7 @@ def fetch_git_sha(path, head=None):
3434 if not os .path .exists (revision_file ):
3535 if not os .path .exists (os .path .join (path , '.git' )):
3636 raise InvalidGitRepository (
37- '%s does not seem to be the root of a git repository' % ( path ,) )
37+ f' { path } does not seem to be the root of a git repository' )
3838
3939 # Check for our .git/packed-refs' file since a `git gc` may have run
4040 # https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery
@@ -52,7 +52,7 @@ def fetch_git_sha(path, head=None):
5252 return str (revision )
5353
5454 raise InvalidGitRepository (
55- 'Unable to find ref to head "%s " in repository' % ( head ,) )
55+ f 'Unable to find ref to head "{ head } " in repository' )
5656
5757 with open (revision_file ) as fh :
5858 return str (fh .read ()).strip ()
0 commit comments