From b25be806701f8fbacf6c11278601ee77ed6d05e1 Mon Sep 17 00:00:00 2001 From: z4yx Date: Sat, 14 Mar 2020 11:01:34 +0800 Subject: [PATCH] extra options should only be applied to the second stage --- worker/provider_test.go | 4 ++-- worker/two_stage_rsync_provider.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/worker/provider_test.go b/worker/provider_test.go index ff5ba32..95a49fe 100644 --- a/worker/provider_test.go +++ b/worker/provider_test.go @@ -458,7 +458,7 @@ exit 0 fmt.Sprintf( "-aHvh --no-o --no-g --stats --exclude .~tmp~/ --safe-links "+ "--timeout=120 --contimeout=120 --exclude dists/ -6 "+ - "--exclude-from %s --delete-excluded --cache %s %s", + "--exclude-from %s %s %s", provider.excludeFile, provider.upstreamURL, provider.WorkingDir(), ), targetDir, @@ -497,7 +497,7 @@ exit 0 expectedOutput := fmt.Sprintf( "-aHvh --no-o --no-g --stats --exclude .~tmp~/ --safe-links "+ "--timeout=120 --contimeout=120 --exclude dists/ -6 "+ - "--exclude-from %s --delete-excluded --cache %s %s\n", + "--exclude-from %s %s %s\n", provider.excludeFile, provider.upstreamURL, provider.WorkingDir(), ) diff --git a/worker/two_stage_rsync_provider.go b/worker/two_stage_rsync_provider.go index aa085e3..e865490 100644 --- a/worker/two_stage_rsync_provider.go +++ b/worker/two_stage_rsync_provider.go @@ -106,6 +106,9 @@ func (p *twoStageRsyncProvider) Options(stage int) ([]string, error) { } else if stage == 2 { options = append(options, p.stage2Options...) + if p.extraOptions != nil { + options = append(options, p.extraOptions...) + } } else { return []string{}, fmt.Errorf("Invalid stage: %d", stage) } @@ -117,9 +120,6 @@ func (p *twoStageRsyncProvider) Options(stage int) ([]string, error) { if p.excludeFile != "" { options = append(options, "--exclude-from", p.excludeFile) } - if p.extraOptions != nil { - options = append(options, p.extraOptions...) - } return options, nil }