@@ -2536,21 +2536,19 @@ func fetch(gitClient git.Client, targetRevisions []string) error {
25362536// removeStaleGitLocks best-effort removes common stale git lock files in the repository.
25372537// It is safe to call while holding the per-repo lock and before running any git commands.
25382538
2539- func removeStaleGitLocks (repoRoot string ) {
2539+ func removeStaleGitLock (repoRoot string ) {
25402540 path := filepath .Join (repoRoot , ".git" , "HEAD.lock" )
25412541 log .Infof ("Checking whether HEAD.lock exists %s" , path )
25422542 if _ , err := os .Stat (path ); err == nil {
25432543 log .Warnf ("HEAD.lock present in git repository %s, removing it" , repoRoot )
2544- if rmErr := os .Remove (path ); rmErr == nil {
2545- log .Infof ("Removed stale git lock %s" , path )
2546- } else if ! os .IsNotExist (rmErr ) {
2547- log .Warnf ("Failed to remove git lock %s: %v" , path , rmErr )
2544+ if rmErr := os .Remove (path ); rmErr != nil {
2545+ log .Errorf ("Failed to remove git lock %s: %v" , path , rmErr )
25482546 }
25492547 }
25502548}
25512549
25522550func checkoutRevision (gitClient git.Client , revision string , submoduleEnabled bool ) error {
2553- removeStaleGitLocks (gitClient .Root ())
2551+ removeStaleGitLock (gitClient .Root ())
25542552
25552553 err := gitClient .Init ()
25562554 if err != nil {
0 commit comments