commands: teach newUploadContext() to use cfg.Remote()

This commit is contained in:
rick olson 2017-10-27 16:14:26 -06:00
parent abbabdbe09
commit 29930e5ed5
3 changed files with 8 additions and 7 deletions

@ -49,8 +49,9 @@ func prePushCommand(cmd *cobra.Command, args []string) {
if err := git.ValidateRemote(args[0]); err != nil { if err := git.ValidateRemote(args[0]); err != nil {
Exit("Invalid remote name %q", args[0]) Exit("Invalid remote name %q", args[0])
} }
cfg.SetRemote(args[0])
ctx := newUploadContext(args[0], prePushDryRun) ctx := newUploadContext(prePushDryRun)
gitscanner, err := ctx.buildGitScanner() gitscanner, err := ctx.buildGitScanner()
if err != nil { if err != nil {

@ -117,7 +117,9 @@ func pushCommand(cmd *cobra.Command, args []string) {
Exit("Invalid remote name %q", args[0]) Exit("Invalid remote name %q", args[0])
} }
ctx := newUploadContext(args[0], pushDryRun) cfg.SetRemote(args[0])
ctx := newUploadContext(pushDryRun)
if pushObjectIDs { if pushObjectIDs {
if len(args) < 2 { if len(args) < 2 {

@ -90,12 +90,9 @@ const (
verifyStateDisabled verifyStateDisabled
) )
func newUploadContext(remote string, dryRun bool) *uploadContext { func newUploadContext(dryRun bool) *uploadContext {
cfg.SetRemote(remote)
ctx := &uploadContext{ ctx := &uploadContext{
Remote: remote, Remote: cfg.Remote(),
Manifest: getTransferManifestOperationRemote("upload", remote),
DryRun: dryRun, DryRun: dryRun,
uploadedOids: tools.NewStringSet(), uploadedOids: tools.NewStringSet(),
gitfilter: lfs.NewGitFilter(cfg), gitfilter: lfs.NewGitFilter(cfg),
@ -105,6 +102,7 @@ func newUploadContext(remote string, dryRun bool) *uploadContext {
allowMissing: cfg.Git.Bool("lfs.allowincompletepush", true), allowMissing: cfg.Git.Bool("lfs.allowincompletepush", true),
} }
ctx.Manifest = getTransferManifestOperationRemote("upload", ctx.Remote)
ctx.meter = buildProgressMeter(ctx.DryRun) ctx.meter = buildProgressMeter(ctx.DryRun)
ctx.tq = newUploadQueue(ctx.Manifest, ctx.Remote, tq.WithProgress(ctx.meter), tq.DryRun(ctx.DryRun)) ctx.tq = newUploadQueue(ctx.Manifest, ctx.Remote, tq.WithProgress(ctx.meter), tq.DryRun(ctx.DryRun))
ctx.committerName, ctx.committerEmail = cfg.CurrentCommitter() ctx.committerName, ctx.committerEmail = cfg.CurrentCommitter()