diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/bugs/fatal:_Out_of_memory__63___mmap_failed:_No_error.mdwn | 1 | ||||
-rwxr-xr-x | doc/tips/automatically_adding_metadata/pre-commit-annex | 24 |
2 files changed, 20 insertions, 5 deletions
diff --git a/doc/bugs/fatal:_Out_of_memory__63___mmap_failed:_No_error.mdwn b/doc/bugs/fatal:_Out_of_memory__63___mmap_failed:_No_error.mdwn index f9a619ab0..d4bb7bede 100644 --- a/doc/bugs/fatal:_Out_of_memory__63___mmap_failed:_No_error.mdwn +++ b/doc/bugs/fatal:_Out_of_memory__63___mmap_failed:_No_error.mdwn @@ -28,3 +28,4 @@ Windows 8. ### Please provide any additional information below. +> closing as not a git-annex bug at all, but a git bug. [[done]] --[[Joey]] diff --git a/doc/tips/automatically_adding_metadata/pre-commit-annex b/doc/tips/automatically_adding_metadata/pre-commit-annex index f300bd731..fe818d032 100755 --- a/doc/tips/automatically_adding_metadata/pre-commit-annex +++ b/doc/tips/automatically_adding_metadata/pre-commit-annex @@ -1,6 +1,11 @@ #!/bin/sh +# # This script can be used to add git-annex metadata to files when they're -# committed. +# committed. It is typically installed as .git/hooks/pre-commit-annex +# +# You can also run this script by hand, passing it the names of files +# already checked into git-annex, and it will extract/refresh the git-annex +# metadata from the files. # # Copyright 2014 Joey Hess <id@joeyh.name> # License: GPL-3+ @@ -12,8 +17,6 @@ if [ -z "$want" ]; then exit 0 fi -echo "$want" - case "$(git config --bool metadata.overwrite || true)" in true) overwrite=1 @@ -46,7 +49,8 @@ fi IFS=" " -for f in $(git diff-index --name-only --cached $against); do + +process () { if [ -e "$f" ]; then for l in $(extract "$f" | egrep "$want"); do field="${l%% - *}" @@ -54,4 +58,14 @@ for f in $(git diff-index --name-only --cached $against); do addmeta "$f" "$field" "$value" done fi -done +} + +if [ -n "$*" ]; then + for f in $@; do + process "$f" + done +else + for f in $(git diff-index --name-only --cached $against); do + process "$f" + done +fi |