aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2018-02-26 12:58:37 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2018-02-26 12:58:37 -0400
commit27b7de929fbdd8bde934d098ea47c418f688c464 (patch)
tree3394db7d1f7231e0620d92051fbbf5d9f510dcbd
parente124fda8ea392e8b21ad293cd1e877f3f5a3dc95 (diff)
Fix metadata hook script to support non-ascii characters
tips/automatically_adding_metadata/pre-commit-annex: Fix to not silently skip filenames containing non-ascii characters. git diff-index defaults to munging non-ascii characters. Using -z makes it not do that, and then we just change the nulls to newlines. This commit was sponsored by Jochen Bartl on Patreon.
-rw-r--r--CHANGELOG2
-rw-r--r--doc/bugs/automatically_adding_metadata_fails_on_files_with_UTF-8_umlauts.mdwn3
-rwxr-xr-xdoc/tips/automatically_adding_metadata/pre-commit-annex2
3 files changed, 6 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index fdda10391..6246c46a1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -28,6 +28,8 @@ git-annex (6.20180113) UNRELEASED; urgency=medium
and the destination subdirectory does not exist yet.
* Added annex.merge-annex-branches config setting which
can be used to disable automatic merge of git-annex branches.
+ * tips/automatically_adding_metadata/pre-commit-annex: Fix to not
+ silently skip filenames containing non-ascii characters.
-- Joey Hess <id@joeyh.name> Wed, 24 Jan 2018 20:42:55 -0400
diff --git a/doc/bugs/automatically_adding_metadata_fails_on_files_with_UTF-8_umlauts.mdwn b/doc/bugs/automatically_adding_metadata_fails_on_files_with_UTF-8_umlauts.mdwn
index 1eff47f2e..ba55b41d1 100644
--- a/doc/bugs/automatically_adding_metadata_fails_on_files_with_UTF-8_umlauts.mdwn
+++ b/doc/bugs/automatically_adding_metadata_fails_on_files_with_UTF-8_umlauts.mdwn
@@ -65,3 +65,6 @@ ok
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
git annex is great. :)
+
+> [[fixed|done]]; caused by git diff-index defaulting to not emitting such
+> characters, got it to by using -z. --[[Joey]]
diff --git a/doc/tips/automatically_adding_metadata/pre-commit-annex b/doc/tips/automatically_adding_metadata/pre-commit-annex
index 2e07e3bf4..982fcca7d 100755
--- a/doc/tips/automatically_adding_metadata/pre-commit-annex
+++ b/doc/tips/automatically_adding_metadata/pre-commit-annex
@@ -112,7 +112,7 @@ if [ -n "$*" ]; then
process "$f"
done
else
- git diff-index --name-only --cached $against | while read f; do
+ git diff-index -z --name-only --cached $against | sed 's/\x00/\n/g' | while read f; do
process "$f"
done
fi