File: Let_watch_selectively_annex_files.mdwn

package info (click to toggle)
git-annex 5.20141125
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 37,828 kB
  • ctags: 583
  • sloc: haskell: 42,582; sh: 1,080; ansic: 498; makefile: 316; perl: 125
file content (27 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download | duplicates (11)
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
Hello,

First of all, thanks to Joey for developing git-annex, good job!

I have a small feature request: when running git annex watch, new files are automatically added to the annex. It would be nice to let this depend on an attribute: add a file to annex if an attribute is set, otherwise do a regular git add.

My use-case is the following: I have a repository containing documents I'm working on (mostly LaTeX), which I'd like to be regular files in git (no annex), and a bunch of extra documentation (pdfs) and images, which I'd like to go to the annex. I currently set a git-attribute (addtoannex), and use a shell script to selectively add files to annex as follows:

Content of .gitattributes:

    *.png addtoannex
    *.jpg addtoannex

Snippet of add script:

    git check-attr addtoannex "$FILE" | grep -q ": set$"
    if [ $? -eq 0 ]; then
        git annex add "$FILE"
    else
        git add "$FILE"
    fi

It would be great if the watcher could honour an attribute.

best regards,

Tom