2012-10-08 17:16:53 +00:00
|
|
|
git-annex tries to ensure that the configured number of [[copies]] of your
|
|
|
|
data always exist, and leaves it up to you to use commands like `git annex
|
|
|
|
get` and `git annex drop` to move the content to the repositories you want
|
2014-03-29 18:39:10 +00:00
|
|
|
to contain it. But often, it can be good to have more fine-grained
|
2014-03-15 20:38:30 +00:00
|
|
|
control over which content is wanted by which repositories. Configuring
|
2014-01-19 21:35:36 +00:00
|
|
|
this allows the git-annex assistant as well as
|
|
|
|
`git annex get --auto`, `git annex drop --auto`, `git annex sync --content`,
|
|
|
|
etc to do smarter things.
|
2012-10-08 17:16:53 +00:00
|
|
|
|
2013-05-25 16:44:58 +00:00
|
|
|
Preferred content settings can be edited using `git
|
2013-10-28 18:08:38 +00:00
|
|
|
annex vicfg`, or viewed and set at the command line with `git annex wanted`.
|
2014-01-19 21:35:36 +00:00
|
|
|
Each repository can have its own settings, and other repositories will
|
|
|
|
try to honor those settings when interacting with it.
|
2014-03-15 20:38:30 +00:00
|
|
|
(So there's no local `.git/config` for preferred content settings.)
|
2012-10-08 17:16:53 +00:00
|
|
|
|
2014-03-14 19:14:18 +00:00
|
|
|
The idea is that you write an expression that files are matched against.
|
2014-03-15 20:38:30 +00:00
|
|
|
If a file matches, the repository wants to store its content.
|
|
|
|
If it doesn't, the repository wants to drop its content
|
|
|
|
(if there are enough copies elsewhere to allow removing it).
|
2014-03-14 19:04:33 +00:00
|
|
|
|
2015-06-17 00:30:48 +00:00
|
|
|
## writing expressions
|
|
|
|
|
|
|
|
[[!template id=note text="""
|
|
|
|
### [[quickstart|standard_groups]]
|
|
|
|
|
|
|
|
Rather than writing your own preferred content expression, you can use
|
|
|
|
several standard ones included in git-annex that are tuned to cover different
|
|
|
|
common use cases.
|
|
|
|
|
|
|
|
You do this by putting a repository in a group,
|
|
|
|
and simply setting its preferred content to "standard" to match whatever
|
|
|
|
is standard for that group. See [[standard_groups]] for a list.
|
|
|
|
"""]]
|
|
|
|
|
2016-01-22 16:24:15 +00:00
|
|
|
See the man page [[git-annex-preferred-content]] for details on the syntax
|
|
|
|
of preferred content expressions.
|
2015-06-17 00:30:48 +00:00
|
|
|
|
2016-01-22 16:24:15 +00:00
|
|
|
An example:
|
2015-01-16 17:47:07 +00:00
|
|
|
|
2016-01-22 16:24:15 +00:00
|
|
|
include=*.mp3 and (not largerthan=100mb) and exclude=old/*
|
2015-06-16 21:03:34 +00:00
|
|
|
|
2016-01-22 16:24:15 +00:00
|
|
|
This makes all .mp3 files, and all other files that are less than 100 mb in
|
|
|
|
size be preferred content. It excludes all files under the "old" directory.
|
2015-06-16 21:03:34 +00:00
|
|
|
|
2014-03-19 23:55:24 +00:00
|
|
|
## upgrades
|
|
|
|
|
|
|
|
It's important that all clones of a repository can understand one-another's
|
|
|
|
preferred content expressions, especially when using the git-annex
|
|
|
|
assistant. So using newly added keywords can cause a problem if
|
2014-03-20 04:10:12 +00:00
|
|
|
an older version of git-annex is in use elsewhere.
|
|
|
|
|
|
|
|
Before git-annex version 5.20140320, when git-annex saw a keyword it
|
|
|
|
did not understand, it defaulted to assuming *all* files were
|
|
|
|
preferred content. From version 5.20140320, git-annex has a nicer fallback
|
|
|
|
behavior: When it is unable to parse a preferred content expression,
|
|
|
|
it assumes all files that are currently present are preferred content.
|
2014-03-19 23:55:24 +00:00
|
|
|
|
|
|
|
Here are recent changes to preferred content expressions, and the version
|
|
|
|
they were added in.
|
|
|
|
|
2015-06-16 21:03:34 +00:00
|
|
|
* "anything" 5.20150616
|
2014-03-19 23:55:24 +00:00
|
|
|
* "standard" 5.20140314
|
|
|
|
(only when used in a more complicated expression; "standard" by
|
|
|
|
itself has been supported for a long time)
|
|
|
|
* "groupwanted=" 5.20140314
|
|
|
|
* "metadata=" 5.20140221
|
|
|
|
* "lackingcopies=", "approxlackingcopies=", "unused=" 5.20140127
|
|
|
|
* "inpreferreddir=" 4.20130501
|