diff --git a/commands/command_pre_push.go b/commands/command_pre_push.go index 83d9babd..fd551eba 100644 --- a/commands/command_pre_push.go +++ b/commands/command_pre_push.go @@ -49,8 +49,9 @@ func prePushCommand(cmd *cobra.Command, args []string) { if err := git.ValidateRemote(args[0]); err != nil { Exit("Invalid remote name %q", args[0]) } + cfg.SetRemote(args[0]) - ctx := newUploadContext(args[0], prePushDryRun) + ctx := newUploadContext(prePushDryRun) gitscanner, err := ctx.buildGitScanner() if err != nil { diff --git a/commands/command_push.go b/commands/command_push.go index 838e6223..1a1d89e8 100644 --- a/commands/command_push.go +++ b/commands/command_push.go @@ -117,7 +117,9 @@ func pushCommand(cmd *cobra.Command, args []string) { Exit("Invalid remote name %q", args[0]) } - ctx := newUploadContext(args[0], pushDryRun) + cfg.SetRemote(args[0]) + + ctx := newUploadContext(pushDryRun) if pushObjectIDs { if len(args) < 2 { diff --git a/commands/uploader.go b/commands/uploader.go index 603b7de2..bc824f09 100644 --- a/commands/uploader.go +++ b/commands/uploader.go @@ -90,12 +90,9 @@ const ( verifyStateDisabled ) -func newUploadContext(remote string, dryRun bool) *uploadContext { - cfg.SetRemote(remote) - +func newUploadContext(dryRun bool) *uploadContext { ctx := &uploadContext{ - Remote: remote, - Manifest: getTransferManifestOperationRemote("upload", remote), + Remote: cfg.Remote(), DryRun: dryRun, uploadedOids: tools.NewStringSet(), gitfilter: lfs.NewGitFilter(cfg), @@ -105,6 +102,7 @@ func newUploadContext(remote string, dryRun bool) *uploadContext { allowMissing: cfg.Git.Bool("lfs.allowincompletepush", true), } + ctx.Manifest = getTransferManifestOperationRemote("upload", ctx.Remote) ctx.meter = buildProgressMeter(ctx.DryRun) ctx.tq = newUploadQueue(ctx.Manifest, ctx.Remote, tq.WithProgress(ctx.meter), tq.DryRun(ctx.DryRun)) ctx.committerName, ctx.committerEmail = cfg.CurrentCommitter()