Skip to content

backup: allow excluding online-only cloud files#4990

Merged
MichaelEischer merged 1 commit intorestic:masterfrom
m-wild:exclude-cloud-files
Jan 13, 2025
Merged

backup: allow excluding online-only cloud files#4990
MichaelEischer merged 1 commit intorestic:masterfrom
m-wild:exclude-cloud-files

Conversation

@m-wild
Copy link
Copy Markdown
Contributor

@m-wild m-wild commented Aug 8, 2024

What does this PR change? What problem does it solve?

Allow excluding online-only cloud files (such as OneDrive Files On-Demand) with a switch --exclude-cloud-files

Assuming we have the following file test.txt in OneDrive, but not available on the device

image

image

Attempting to backup the file with the --exclude-cloud-files switch will not attempt to download the file locally, instead the file will be excluded.

restic -r test --verbose backup C:\Users\username\OneDrive\test.txt --exclude-cloud-files

open repository
repository e5f7dfde opened (version 2, compression level auto)
created new cache in C:\Users\username\AppData\Local\restic
no parent snapshot found, will read all files
load index files
[0:00]          0 index files loaded
start scan on [C:\Users\username\OneDrive\test.txt]
start backup on [C:\Users\username\OneDrive\test.txt]
scan finished in 0.003s: 0 files, 0 B

Files:           0 new,     0 changed,     0 unmodified
Dirs:            4 new,     0 changed,     0 unmodified
Data Blobs:      0 new
Tree Blobs:      5 new
Added to the repository: 2.425 KiB (1.841 KiB stored)

processed 0 files, 0 B in 0:00
snapshot 5ef1ff96 saved
2024/08/08 22:39:41 archiver/tree.go:298	archiver.NewTree	1	result:
/C, root "C:\\", path "", meta "C:\\"
    /Users, root "", path "", meta "C:\\Users"
        /username, root "", path "", meta "C:\\Users\\username"
            /OneDrive, root "", path "", meta "C:\\Users\\username\\OneDrive"
                /test.txt, root "", path "C:\\Users\\username\\OneDrive\\test.txt", meta ""

...

2024/08/08 22:39:44 archiver/archiver.go:420	archiver.(*Archiver).save	40	/C/Users/username/OneDrive/test.txt target "C:\\Users\\username\\OneDrive\\test.txt", previous <nil>
2024/08/08 22:39:44 restic/exclude.go:404	main.collectRejectFuncs.rejectCloudFiles.func1	40	rejecting online-only cloud file C:\Users\username\OneDrive\test.txt
2024/08/08 22:39:44 archiver/archiver.go:443	archiver.(*Archiver).save	40	C:\Users\username\OneDrive\test.txt is excluded

Was the change previously discussed in an issue or on the forum?

Closes #3697

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@m-wild m-wild force-pushed the exclude-cloud-files branch from 554229d to 1504042 Compare August 8, 2024 11:29
@m-wild m-wild marked this pull request as ready for review August 8, 2024 11:31
@m-wild
Copy link
Copy Markdown
Contributor Author

m-wild commented Aug 8, 2024

@MichaelEischer I'm not really sure how to add tests for this one. It would require either manually setting the file attributes or somehow setting up OneDrive on Windows?

@deajan
Copy link
Copy Markdown

deajan commented Sep 7, 2024

@m-wild I really love that PR. That's exactly what I'm searching for more than a year at #4155
I'll happily make some tests with some beta builds if needed.

@greatroar
Copy link
Copy Markdown
Contributor

There's already an option --one-file-system. Can this feature use that option, instead of introducing a new one? Or does it already have a meaning on Windows?

@MichaelEischer
Copy link
Copy Markdown
Member

There's already an option --one-file-system. Can this feature use that option, instead of introducing a new one? Or does it already have a meaning on Windows?

--one-file-system currently has no effect on Windows. However, Windows does support junctions which can be used to mount other filesystems within a filesystem. My expectation would be that --one-file-system once it has an effect, addresses exactly this scenario.

Cloud files feel somewhat different: they are placeholders for files that can basically show up everywhere in the filesystem. I wouldn't really expect that --one-file-system excludes those files.

@deajan
Copy link
Copy Markdown

deajan commented Oct 24, 2024

@m-wild Any news on this one perhaps ?

@MichaelEischer
Copy link
Copy Markdown
Member

If someone is interested in taking over this PR, please just create a new PR, then I'll close this one.

@deajan
Copy link
Copy Markdown

deajan commented Nov 12, 2024

@m-wild @MichaelEischer I'll happily sponsor whoever wants to pick this up ;)

@deajan
Copy link
Copy Markdown

deajan commented Dec 17, 2024

@m-wild Do you still want to work on this ?

@m-wild
Copy link
Copy Markdown
Contributor Author

m-wild commented Dec 19, 2024

@m-wild Do you still want to work on this ?

Planning to pick it up over the Xmas break

@m-wild
Copy link
Copy Markdown
Contributor Author

m-wild commented Dec 24, 2024

Ho ho ho, it's a Christmas miracle, a PR ready to review.

@deajan
Copy link
Copy Markdown

deajan commented Dec 24, 2024

Ho ho ho, it's a Christmas miracle, a PR ready to review.

Ho ho ho, ping me whenever this is merged so I can sponsor you a bit ;)

@m-wild m-wild force-pushed the exclude-cloud-files branch from 9b69e17 to fbe76e9 Compare January 11, 2025 21:51
@m-wild
Copy link
Copy Markdown
Contributor Author

m-wild commented Jan 11, 2025

Have just fixed the lint issues.

Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the PR! I'm mostly happy with it except for a few nits.

@m-wild m-wild force-pushed the exclude-cloud-files branch from fbe76e9 to a7539ff Compare January 12, 2025 16:32
@m-wild m-wild requested a review from MichaelEischer January 12, 2025 16:34
Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@MichaelEischer
Copy link
Copy Markdown
Member

(Force pushed to fix the linter warning)

@deajan
Copy link
Copy Markdown

deajan commented Jan 20, 2025

Can confirm that the new option --exclude-cloud-files works great with a test nextcloud setup using current restic beta binary.
Thank you for that great work.

@m-wild As I suggested earlier, I'd like to sponsor you a bit. Do you have any donation system setup perhaps ?

@m-wild
Copy link
Copy Markdown
Contributor Author

m-wild commented Jan 20, 2025

@deajan thanks for testing the beta :) I have GitHub sponsorship enabled.

@m-wild m-wild deleted the exclude-cloud-files branch January 20, 2025 13:15
@deajan
Copy link
Copy Markdown

deajan commented Jan 20, 2025

@m-wild Done ;) Thank you again.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore Cloud files which are not synced locally

4 participants