From f1e698e225e738595092bb6dc75b36fbaac76370 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Fri, 11 Mar 2022 08:32:26 -0800 Subject: [PATCH] Support repo change between invocations main logic from PR 499 (v3) from sed-i --- cmd/git-sync/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/git-sync/main.go b/cmd/git-sync/main.go index 81c789c..66f610f 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -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 }