Skip to content

diff: handle deleted_item in --sort-by attribute and timestamp diff keys, fixes #10610 - #10631

Open
shikhabhadoria wants to merge 1 commit into
borgbackup:masterfrom
shikhabhadoria:fix-diff-sort-by-deleted-item-10610
Open

shikhabhadoria wants to merge 1 commit into
borgbackup:masterfrom
shikhabhadoria:fix-diff-sort-by-deleted-item-10610

Conversation

@shikhabhadoria

Copy link
Copy Markdown

Fixes #10610.

In Archive.compare_archives_iter(), the missing side of ItemDiff for added or removed items is Item(deleted=True) rather than None, and bool(Item(deleted=True)) is True.

In DiffMixIn.do_diff() (src/borg/archiver/diff_cmd.py):

  • Fall back to d._item1 when d._item2 is None or d._item2.get("deleted") so removed items sort by their ARCHIVE1 attributes (user, group, uid, gid, ctime, mtime) instead of the dummy defaults.
  • Return 0 for ctime_diff and mtime_diff when either item is None or marked deleted, matching ItemDiff._time_diffs().
  • Add test_sort_by_deleted_and_added_items in src/borg/testsuite/archiver/diff_cmd_test.py.

@shikhabhadoria

Copy link
Copy Markdown
Author

This PR is ready for review whenever convenient.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant