Support repo change between invocations

main logic from PR 499 (v3) from sed-i
This commit is contained in:
Tim Hockin 2022-03-11 08:32:26 -08:00
parent b3a261c673
commit f1e698e225
1 changed files with 2 additions and 2 deletions

View File

@ -928,7 +928,7 @@ func (git *repoSync) AddWorktreeAndSwap(ctx context.Context, hash string) error
if git.branch != "" {
fetch = git.branch
}
args = append(args, "origin", fetch)
args = append(args, git.repo, fetch)
// Update from the remote.
if _, err := git.run.Run(ctx, git.root, nil, git.cmd, args...); err != nil {
@ -1200,7 +1200,7 @@ func (git *repoSync) LocalHashForRev(ctx context.Context, rev string) (string, e
// RemoteHashForRef returns the upstream hash for a given ref.
func (git *repoSync) RemoteHashForRef(ctx context.Context, ref string) (string, error) {
output, err := git.run.Run(ctx, git.root, nil, git.cmd, "ls-remote", "-q", "origin", ref)
output, err := git.run.Run(ctx, git.root, nil, git.cmd, "ls-remote", "-q", git.repo, ref)
if err != nil {
return "", err
}