{"action":"created","issue":{"url":"https://api.github.com/repos/borgbackup/borg/issues/1406","repository_url":"https://api.github.com/repos/borgbackup/borg","labels_url":"https://api.github.com/repos/borgbackup/borg/issues/1406/labels{/name}","comments_url":"https://api.github.com/repos/borgbackup/borg/issues/1406/comments","events_url":"https://api.github.com/repos/borgbackup/borg/issues/1406/events","html_url":"https://github.com/borgbackup/borg/issues/1406","id":168428986,"number":1406,"title":"add include patterns","user":{"login":"leo-b","id":6097948,"avatar_url":"https://avatars.githubusercontent.com/u/6097948?v=3","gravatar_id":"","url":"https://api.github.com/users/leo-b","html_url":"https://github.com/leo-b","followers_url":"https://api.github.com/users/leo-b/followers","following_url":"https://api.github.com/users/leo-b/following{/other_user}","gists_url":"https://api.github.com/users/leo-b/gists{/gist_id}","starred_url":"https://api.github.com/users/leo-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leo-b/subscriptions","organizations_url":"https://api.github.com/users/leo-b/orgs","repos_url":"https://api.github.com/users/leo-b/repos","events_url":"https://api.github.com/users/leo-b/events{/privacy}","received_events_url":"https://api.github.com/users/leo-b/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":35,"created_at":"2016-07-29T22:47:20Z","updated_at":"2016-09-06T10:08:29Z","closed_at":null,"body":"Sometimes the ability to not only exclude patterns but also explicitly specify includes can be useful.\r\n\r\nI propose a new optional pattern prefix '+' that may be used with --exclude or in --exclude-from files to define include-patterns. (Just like include/exclude pattern rules in rsync.)\r\n\r\nThese patterns may be used to explicitly include files in a backup that would otherwise be excluded by a following pattern.\r\n\r\nSome use cases:\r\n\r\n- exclude docs but backup pdfs:\r\n  ```\r\n  --exclude +/data/docs/pdf --exclude /data/docs/\r\n  ```\r\n  (maybe ``--include /data/docs/pdf`` should be introduced to improve readability.)\r\n\r\n- use a common exclude list deployed to all backup clients but override it on some specific client:\r\n\r\n ``global.inclexcl``:\r\n  ```\r\n  /tmp\r\n  *.tmp\r\n  /scratch\r\n  ```\r\n\r\n ``local.inclexcl``:\r\n  ```\r\n  +/scratch\r\n  /home/dir_to_exclude\r\n  ```\r\n\r\n  ``$ borg create --exclude-from local.inclexcl --exclude-from global.inclexl backup /``\r\n\r\n  equivalent:\r\n\r\n  ``global.inclexcl``:\r\n\r\n  ```\r\n  -sh:/tmp\r\n  -fm:*.tmp\r\n  -fm:/scratch\r\n```\r\n\r\n  ``local.inclexcl``:\r\n  ```\r\n  +fm:/scratch\r\n  -/home/dir_to_exclude\r\n  ```\r\n\r\n\r\n(Actually the same approach is already used by the --keep-tag-files option.)\r\n"},"comment":{"url":"https://api.github.com/repos/borgbackup/borg/issues/comments/244907159","html_url":"https://github.com/borgbackup/borg/issues/1406#issuecomment-244907159","issue_url":"https://api.github.com/repos/borgbackup/borg/issues/1406","id":244907159,"user":{"login":"enkore","id":1330164,"avatar_url":"https://avatars.githubusercontent.com/u/1330164?v=3","gravatar_id":"","url":"https://api.github.com/users/enkore","html_url":"https://github.com/enkore","followers_url":"https://api.github.com/users/enkore/followers","following_url":"https://api.github.com/users/enkore/following{/other_user}","gists_url":"https://api.github.com/users/enkore/gists{/gist_id}","starred_url":"https://api.github.com/users/enkore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enkore/subscriptions","organizations_url":"https://api.github.com/users/enkore/orgs","repos_url":"https://api.github.com/users/enkore/repos","events_url":"https://api.github.com/users/enkore/events{/privacy}","received_events_url":"https://api.github.com/users/enkore/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T10:08:29Z","updated_at":"2016-09-06T10:08:29Z","body":">    By default all files are considered\r\n>\r\n> to:\r\n>\r\n> \"By default all files under roots are considered\"\r\n\r\nKind of implied, but yes.\r\n\r\n> And what will happen if there is multiple root lines? will it be error? will we sum them? will patterns under one root be separated from patterns under another?\r\n\r\nI'd say that only patterns declared after a `root` occurred are considered for a root.\r\n\r\nWhether in this:\r\n\r\n```\r\nroot a\r\n- pat1\r\n- pat2\r\nroot b\r\n- pat3\r\n- pat4\r\n```\r\n\r\n`pat3`, `pat4` also apply to root a can be debated either way.\r\n\r\n> The last line - /home would match and exclude the home directory itself, so borg wouldn't even traverse into the directory. Thus the upper lines won't ever be used.\r\n\r\nYep, has to be '- /home/*` or similar.\r\n\r\n> Besides, + /home/susan would include the directory but not its contents. So an additional + /home/susan/ would be necessary, otherwise - /home/* would match inside susans home.\r\n\r\nIn fnmatch there shouldn't be a difference between these two variants. As soon as a directory is included it's contents are recursively included as well as long as no negative qualifier (--one-file-system, excludes) apply."}}
{"actor":{"display_login":"enkore"}}