From 206550a2466919a1fca91d31c767d2563ae8e094 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 29 Mar 2022 20:57:31 +0200 Subject: [PATCH] Fix diff Nodes in trees were always printed with a `+` in diff, regardless of whether or not a dir was added or removed. Let's use the mode we were passed in printDir(). Closes #3685 --- changelog/unreleased/issue-3685 | 7 +++++++ cmd/restic/cmd_diff.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/issue-3685 diff --git a/changelog/unreleased/issue-3685 b/changelog/unreleased/issue-3685 new file mode 100644 index 000000000..8bb468e87 --- /dev/null +++ b/changelog/unreleased/issue-3685 @@ -0,0 +1,7 @@ +Bugfix: Fix the diff command + +There was a bug in the `diff` command, it would always show files in a removed +directory as added. We've fixed that. + +https://github.com/restic/restic/issues/3685 +https://github.com/restic/restic/pull/3686 diff --git a/cmd/restic/cmd_diff.go b/cmd/restic/cmd_diff.go index 9cdd022fd..f83c87132 100644 --- a/cmd/restic/cmd_diff.go +++ b/cmd/restic/cmd_diff.go @@ -170,7 +170,7 @@ func (c *Comparer) printDir(ctx context.Context, mode string, stats *DiffStat, b if node.Type == "dir" { name += "/" } - c.printChange(NewChange(name, "+")) + c.printChange(NewChange(name, mode)) stats.Add(node) addBlobs(blobs, node)