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 {
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 {

@ -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 {

@ -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()