Skip to content

Commit 7665443

Browse files
committed
Fix bug caused in previous PR
The .git to check is not the root/.git but the link/.git - tests pass now.
1 parent 0ce336f commit 7665443

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmd/git-sync/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,9 +987,9 @@ func syncRepo(ctx context.Context, repo, branch, rev string, depth int, gitRoot,
987987
askpassCount.WithLabelValues(metricKeySuccess).Inc()
988988
}
989989

990-
gitRepoPath := filepath.Join(gitRoot, ".git")
990+
currentWorktreeGit := filepath.Join(dest, ".git")
991991
var hash string
992-
_, err := os.Stat(gitRepoPath)
992+
_, err := os.Stat(currentWorktreeGit)
993993
switch {
994994
case os.IsNotExist(err):
995995
// First time. Just clone it and get the hash.
@@ -1002,7 +1002,7 @@ func syncRepo(ctx context.Context, repo, branch, rev string, depth int, gitRoot,
10021002
return false, "", err
10031003
}
10041004
case err != nil:
1005-
return false, "", fmt.Errorf("error checking if repo exists %q: %v", gitRepoPath, err)
1005+
return false, "", fmt.Errorf("error checking if a worktree exists %q: %v", currentWorktreeGit, err)
10061006
default:
10071007
// Not the first time. Figure out if the ref has changed.
10081008
local, remote, err := getRevs(ctx, dest, branch, rev)

0 commit comments

Comments
 (0)