Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gitignore vs iglob-file priority #945

Open
kuyagic opened this issue Nov 18, 2023 · 1 comment
Open

.gitignore vs iglob-file priority #945

kuyagic opened this issue Nov 18, 2023 · 1 comment
Labels
A-commands Area: Related to commands in `rustic` A-config Area: Related to the config file functionality and format A-ui-ux Area: Related to user interfaces and user experience C-enhancement Category: New feature or request C-refactor Category: Refactoring of already existing code

Comments

@kuyagic
Copy link

kuyagic commented Nov 18, 2023

I have the following iglob-file

!*.pfx
!*.log

and I backup the .ssh folder with the following .gitignore file in it

netbird-200:~/.ssh# cat .gitignore
!*.pfx
*.old
netbird-200:~/.ssh#

I prefer the pfx file in .ssh folder will be backed up , but it is not being backup.

Here is the full log

netbird-200:~/.ssh# rustic backup -n --log-level debug > /dev/stdout  2> /dev/stdout  | grep ignoring
[DEBUG] (27) ignore::walk: ignoring /root/.ash_history: Ignore(IgnoreMatch(Override(Glob(Matched(Glob { from: None, original: "!**/.*_history",
 actual: "**/.*_history", is_whitelist: true, is_only_dir: false })))))
[DEBUG] (27) ignore::walk: ignoring /root/.cache: Ignore(IgnoreMatch(Override(Glob(Matched(Glob { from: None, original: "!**/.cache", actual: "
**/.cache", is_whitelist: true, is_only_dir: false })))))
[DEBUG] (27) ignore::walk: ignoring /root/.gnupg/S.dirmngr: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/root/.gnupg/.gitignore"), original
: "S.*", actual: "**/S.*", is_whitelist: false, is_only_dir: false })))
[DEBUG] (27) ignore::walk: ignoring /root/.gnupg/S.gpg-agent: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/root/.gnupg/.gitignore"), origin
al: "S.*", actual: "**/S.*", is_whitelist: false, is_only_dir: false })))
[DEBUG] (27) ignore::walk: ignoring /root/.gnupg/S.gpg-agent.browser: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/root/.gnupg/.gitignore")
, original: "S.*", actual: "**/S.*", is_whitelist: false, is_only_dir: false })))
[DEBUG] (27) ignore::walk: ignoring /root/.gnupg/S.gpg-agent.extra: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/root/.gnupg/.gitignore"),
original: "S.*", actual: "**/S.*", is_whitelist: false, is_only_dir: false })))
[DEBUG] (27) ignore::walk: ignoring /root/.gnupg/S.gpg-agent.ssh: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/root/.gnupg/.gitignore"), or
iginal: "S.*", actual: "**/S.*", is_whitelist: false, is_only_dir: false })))
[DEBUG] (27) ignore::walk: ignoring /root/.gnupg/S.keyboxd: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/root/.gnupg/.gitignore"), original
: "S.*", actual: "**/S.*", is_whitelist: false, is_only_dir: false })))
[DEBUG] (27) ignore::walk: ignoring /root/.python_history: Ignore(IgnoreMatch(Override(Glob(Matched(Glob { from: None, original: "!**/.*_histor
y", actual: "**/.*_history", is_whitelist: true, is_only_dir: false })))))
[DEBUG] (27) ignore::walk: ignoring /root/.ssh/id_rsa.pfx: Ignore(IgnoreMatch(Override(Glob(Matched(Glob { from: None, original: "!*.pfx", actu
al: "**/*.pfx", is_whitelist: true, is_only_dir: false })))))
[DEBUG] (27) ignore::walk: ignoring /root/.ssh/known_hosts.old: Ignore(IgnoreMatch(Gitignore(Glob { from: Some("/root/.ssh/.gitignore"), origin
al: "*.old", actual: "**/*.old", is_whitelist: false, is_only_dir: false })))

check file being backed up

netbird-200:~/.ssh# rustic backup                                                                                             12:44:38 [5/7356]
using config /root/.config/rustic/rustic.toml
[INFO] repository rest:http://192.168.11.251:9999/: password is correct.
[INFO] using cache at /root/.cache/rustic/b042fb4f25867ac104f50eca8261ce6d96c585cf5663ccf6afd72547e2d20767
[00:00:00] reading index...               ████████████████████████████████████████          9/9
[INFO] using all backup sources from config file.
[INFO] merging source="/opt","/root","/usr/local/bin","/usr/local/etc" section from config file
[00:00:00] getting latest snapshot...     ████████████████████████████████████████        270/270
[INFO] using no parent
[INFO] starting to backup "/opt","/root","/usr/local/bin","/usr/local/etc"...
[00:00:08] backing up...                  ████████████████████████████████████████ 251.22 MiB/251.22 MiB 29.07 MiB/s  (ETA 0s)
Files:       785 new, 0 changed, 0 unchanged
Dirs:        24 new, 0 changed, 0 unchanged
Added to the repo: 12.9 kiB (raw: 44.4 kiB)
processed 785 files, 251.2 MiB
snapshot e2ed7de3 successfully saved.
[INFO] backup of "/opt","/root","/usr/local/bin","/usr/local/etc" done.
netbird-200:~/.ssh# rustic ls e2ed7de3:/root/.ssh
using config /root/.config/rustic/rustic.toml
[INFO] repository rest:http://192.168.11.251:9999/: password is correct.
[INFO] using cache at /root/.cache/rustic/b042fb4f25867ac104f50eca8261ce6d96c585cf5663ccf6afd72547e2d20767
[00:00:00] reading index...               ████████████████████████████████████████         10/10
[00:00:00] getting snapshot...            ████████████████████████████████████████          0/0
[INFO] getting snapshot...
".gitignore"
"authorized_keys"
"config"
"id_rsa"
"id_rsa.crt"
@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Nov 18, 2023
@aawsome
Copy link
Member

aawsome commented Jan 11, 2024

Thank @kuyagic for opening the issue and sorry for the late reply!
I think we must overwork the including excluding as there are more topics.

When doing the rework, we'll take into account how the let users define priorities between different include/exclude options.

@aawsome aawsome added C-enhancement Category: New feature or request A-commands Area: Related to commands in `rustic` C-refactor Category: Refactoring of already existing code A-ui-ux Area: Related to user interfaces and user experience A-config Area: Related to the config file functionality and format and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Jan 11, 2024
@aawsome aawsome added this to the Overwork includes/excludes milestone Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-commands Area: Related to commands in `rustic` A-config Area: Related to the config file functionality and format A-ui-ux Area: Related to user interfaces and user experience C-enhancement Category: New feature or request C-refactor Category: Refactoring of already existing code
Projects
None yet
Development

No branches or pull requests

2 participants