Skip to content

Commit

Permalink
Allow the sync command to pass --preserve-timestamp to cp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahuge committed Nov 7, 2022
1 parent 7d7260d commit f13420f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions command/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ type Sync struct {
fullCommand string

// flags
delete bool
sizeOnly bool
delete bool
sizeOnly bool
preserveTimestamp bool

// s3 options
storageOpts storage.Options
Expand All @@ -137,8 +138,9 @@ func NewSync(c *cli.Context) Sync {
fullCommand: commandFromContext(c),

// flags
delete: c.Bool("delete"),
sizeOnly: c.Bool("size-only"),
delete: c.Bool("delete"),
sizeOnly: c.Bool("size-only"),
preserveTimestamp: c.Bool("preserve-timestamp"),

// flags
followSymlinks: !c.Bool("no-follow-symlinks"),
Expand Down Expand Up @@ -358,6 +360,9 @@ func (s Sync) planRun(
defaultFlags := map[string]interface{}{
"raw": true,
}
if s.preserveTimestamp {
defaultFlags["preserve-timestamp"] = s.preserveTimestamp
}

// only in source
for _, srcurl := range onlySource {
Expand Down

0 comments on commit f13420f

Please sign in to comment.