Skip to content

Commit

Permalink
Fix bug caused in previous PR
Browse files Browse the repository at this point in the history
The .git to check is not the root/.git but the link/.git - tests pass
now.
  • Loading branch information
thockin committed Jan 24, 2022
1 parent 0ce336f commit 7665443
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/git-sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@ func syncRepo(ctx context.Context, repo, branch, rev string, depth int, gitRoot,
askpassCount.WithLabelValues(metricKeySuccess).Inc()
}

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

0 comments on commit 7665443

Please sign in to comment.