Skip to content

Commit dc34f85

Browse files
committed
distinguish file & docker timestamps
1 parent 8fbae42 commit dc34f85

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cmd/diffoci/commands/diff/diff.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func NewCommand() *cobra.Command {
4343
"ignore-history",
4444
"ignore-file-order",
4545
"ignore-file-mode-redundant-bits",
46+
"ignore-file-timestamps",
4647
"ignore-image-name",
4748
"ignore-tar-format",
4849
"treat-canonical-paths-equal",
@@ -67,6 +68,7 @@ func NewCommand() *cobra.Command {
6768
flags.Bool("ignore-history", false, "Ignore history")
6869
flags.Bool("ignore-file-order", false, "Ignore file order in tar layers")
6970
flags.Bool("ignore-file-mode-redundant-bits", false, "Ignore redundant bits of file mode")
71+
flags.Bool("ignore-file-timestamps", false, "Ignore timestamps on files")
7072
flags.Bool("ignore-image-name", false, "Ignore image name annotation")
7173
flags.Bool("ignore-tar-format", false, "Ignore tar format")
7274
flags.Bool("treat-canonical-paths-equal", false, "Treat leading `./` `/` `` in file paths as canonical")
@@ -111,6 +113,10 @@ func action(cmd *cobra.Command, args []string) error {
111113
if err != nil {
112114
return err
113115
}
116+
options.IgnoreFileTimestamps, err = flags.GetBool("ignore-file-timestamps")
117+
if err != nil {
118+
return err
119+
}
114120
options.IgnoreImageName, err = flags.GetBool("ignore-image-name")
115121
if err != nil {
116122
return err

pkg/diff/diff.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type IgnoranceOptions struct {
3636
IgnoreHistory bool
3737
IgnoreFileOrder bool
3838
IgnoreFileModeRedundantBits bool
39+
IgnoreFileTimestamps bool
3940
IgnoreImageName bool
4041
IgnoreTarFormat bool
4142
CanonicalPaths bool
@@ -865,7 +866,7 @@ func (d *differ) diffTarEntries(ctx context.Context, node *EventTreeNode, in [2]
865866

866867
func (d *differ) diffTarEntry(ctx context.Context, node *EventTreeNode, in [2]EventInput) (dirsToBeRemovedIfEmpty []string, retErr error) {
867868
var negligibleTarFields []string
868-
if d.o.IgnoreTimestamps {
869+
if d.o.IgnoreFileTimestamps {
869870
negligibleTarFields = append(negligibleTarFields, "ModTime", "AccessTime", "ChangeTime", "PAXRecords")
870871
}
871872
cmpOpts := []cmp.Option{cmpopts.IgnoreUnexported(TarEntry{}), cmpopts.IgnoreFields(tar.Header{}, negligibleTarFields...)}

0 commit comments

Comments
 (0)