From 50f6327baf8b91f7dba13e06756939657340be0d Mon Sep 17 00:00:00 2001 From: sed-i <82407168+sed-i@users.noreply.github.com> Date: Thu, 24 Feb 2022 23:08:44 -0500 Subject: [PATCH] Replace "origin" literal with flRepo Replaces the hard-coded literal "origin" with the --repo value. This way cleanup takes place even if --repo value changes between invocations. --- 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 2b629d4..70ec6d4 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -721,7 +721,7 @@ func addWorktreeAndSwap(ctx context.Context, gitRoot, dest, branch, rev string, if depth != 0 { args = append(args, "--depth", strconv.Itoa(depth)) } - args = append(args, "origin", branch) + args = append(args, *flRepo, branch) // Update from the remote. if _, err := cmdRunner.Run(ctx, gitRoot, nil, *flGitCmd, args...); err != nil { @@ -948,7 +948,7 @@ func localHashForRev(ctx context.Context, rev, gitRoot string) (string, error) { // remoteHashForRef returns the upstream hash for a given ref. func remoteHashForRef(ctx context.Context, ref, gitRoot string) (string, error) { - output, err := cmdRunner.Run(ctx, gitRoot, nil, *flGitCmd, "ls-remote", "-q", "origin", ref) + output, err := cmdRunner.Run(ctx, gitRoot, nil, *flGitCmd, "ls-remote", "-q", *flRepo, ref) if err != nil { return "", err }