borg icon indicating copy to clipboard operation
borg copied to clipboard

extract_item: do not delete an existing directory if possible

Open intelfx opened this issue 2 years ago • 3 comments

A pre-existing directory might be a Btrfs subvolume that was created by the user ahead of time when restoring several nested subvolumes from a single archive.


I'm also interested in this feature being backported to Borg 1.2. I have a patch that applies on top of 1.2-maint.

See: #4233

intelfx avatar Oct 10 '23 19:10 intelfx

Please rebase onto current master to fix the mypy issue.

ThomasWaldmann avatar Oct 10 '23 19:10 ThomasWaldmann

Codecov Report

Merging #7866 (aee25c3) into master (9108039) will decrease coverage by 0.22%. The diff coverage is 100.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master    #7866      +/-   ##
==========================================
- Coverage   83.33%   83.12%   -0.22%     
==========================================
  Files          66       66              
  Lines       11853    11826      -27     
  Branches     2149     1866     -283     
==========================================
- Hits         9878     9830      -48     
- Misses       1393     1407      +14     
- Partials      582      589       +7     
Files Coverage Δ
src/borg/archive.py 83.45% <100.00%> (-0.23%) :arrow_down:

... and 19 files with indirect coverage changes

codecov-commenter avatar Oct 10 '23 19:10 codecov-commenter

A small test with an existing fs dir and then extracting "over" that would be good.

ThomasWaldmann avatar Oct 10 '23 20:10 ThomasWaldmann

@intelfx can you add tests?

ThomasWaldmann avatar Nov 04 '23 17:11 ThomasWaldmann