2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

Change diff output slightly

This commit is contained in:
Alexander Neumann 2017-12-05 22:26:56 +01:00
parent df350e1f6e
commit 0405e67f8b

View File

@ -23,8 +23,8 @@ directory:
+ The item was added + The item was added
- The item was removed - The item was removed
M The metadata (access mode, timestamps, ...) for the item was changed U The metadata (access mode, timestamps, ...) for the item was updated
C The contents of a file has changed M The file's content was modified
T The type was changed, e.g. a file was made a symlink T The type was changed, e.g. a file was made a symlink
`, `,
DisableAutoGenTag: true, DisableAutoGenTag: true,
@ -232,18 +232,14 @@ func (c *Comparer) diffTree(ctx context.Context, stats *DiffStats, prefix string
if node1.Type == "file" && if node1.Type == "file" &&
node2.Type == "file" && node2.Type == "file" &&
!reflect.DeepEqual(node1.Content, node2.Content) { !reflect.DeepEqual(node1.Content, node2.Content) {
mod += "C"
stats.ChangedFiles++
if c.opts.ShowMetadata && !node1.Equals(*node2) {
mod += "M"
}
} else if c.opts.ShowMetadata && !node1.Equals(*node2) {
mod += "M" mod += "M"
stats.ChangedFiles++
} else if c.opts.ShowMetadata && !node1.Equals(*node2) {
mod += "U"
} }
if mod != "" { if mod != "" {
Printf(" % -3v %v\n", mod, name) Printf("%-5s%v\n", mod, name)
} }
if node1.Type == "dir" && node2.Type == "dir" { if node1.Type == "dir" && node2.Type == "dir" {
@ -257,7 +253,7 @@ func (c *Comparer) diffTree(ctx context.Context, stats *DiffStats, prefix string
if node1.Type == "dir" { if node1.Type == "dir" {
prefix += "/" prefix += "/"
} }
Printf("- %v\n", prefix) Printf("%-5s%v\n", "-", prefix)
stats.Removed.Add(node1) stats.Removed.Add(node1)
if node1.Type == "dir" { if node1.Type == "dir" {
@ -271,7 +267,7 @@ func (c *Comparer) diffTree(ctx context.Context, stats *DiffStats, prefix string
if node2.Type == "dir" { if node2.Type == "dir" {
prefix += "/" prefix += "/"
} }
Printf("+ %v\n", prefix) Printf("%-5s%v\n", "+", prefix)
stats.Added.Add(node2) stats.Added.Add(node2)
if node2.Type == "dir" { if node2.Type == "dir" {