aboutsummaryrefslogtreecommitdiff
path: root/doc/forum/Automatic___96__git_annex_get__96___after_invalidation_of_local_files_due_to_external_modification__63__.mdwn
blob: 50518e33ada664638b77b0d5f77550d259014b76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Use case

A laptop with a relatively small hard drive has copies of a subset of
all annexed files.  When annexed files are changed externally and `git
annex sync` is run on the laptop, the stale local copies are
invalidated and their symlinks break.  How can I automatically fetch
the updated versions of these previously locally-cached files?

Because I only want a subset of files, I can't do

    git annex add --not --in here --and --in superset.

Because files may be renamed, the
[[tips/automatically_getting_files_on_checkout/]] solution, by making
`dir` specify the subset, will require manually and redundantly
tracking renames.

## Simple ( (?) ) feature addition to git-annex to support this

When locally-cached files are invalidated by `git-annex sync`,
git-annex could notify the user, and give them the option to
`git-annex get` the invalidated files.  Bonus points if the mechanism
allows this to be done at any point in the future, not just when
running `git-annex sync`.  The idea is that git-annex could track
which files, previously cached locally, have been invalidated
*unintentionally* by syncs, and treat them differently from files,
previously cached locally, that have been *intentionally* dropped
using `git-annex drop` or `git-annex move`.

## More generally

The ability to specify a collection of files to always cache locally
(something like a numcopies.here=1), which is robust to renames, would
work.  The "robust to renames" part seems tricky in git: whereas svn
attaches properties to files, and so properties are propagated by `svn
mv`, I believe git attributes are only specified by patterns in
.gitattributes files.

## Related questions / possible approaches

Other forum posts mention [[`git
subtree`|forum/git-subtree_support__63__/]] and [[sparse git
checkouts|forum/sparse_git_checkouts_with_annex/]], but I'm not
familiar with these features and from reading those questions it's
unclear if those approaches will work for me.  Does anyone more
familiar see how to adapt one of those features to my use case?