handle multibyte characters in name

Many "git submodule" operations do not work on a submodule at a path whose name is not in ASCII. This is because "git ls-files" is used to find which paths are bound to submodules to the current working tree, and the output is C-quoted by default for non ASCII pathnames. Tell "git ls-files" to not C-quote its output, which is easier than unwrapping C-quote ourselves. Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fredrik Gustafsson committed Jun 14, 2013 at 02:26 UTC 74671241fd53df2899d4b4400593afc12e8e1bf7
2 files changed +14 -1
git-submodule.sh
+2 -1
@@ -113,7 +113,7 @@ resolve_relative_url ()
113 module_list()
114 {
115 (
116 - git ls-files --error-unmatch --stage -- "$@" ||
116 + git ls-files -z --error-unmatch --stage -- "$@" ||
117 echo "unmatched pathspec exists"
118 ) |
119 perl -e '
@@ -121,6 +121,7 @@ module_list()
121 my ($null_sha1) = ("0" x 40);
122 my @out = ();
123 my $unmatched = 0;
124 + $/ = "\0";
125 while (<STDIN>) {
126 if (/^unmatched pathspec/) {
127 $unmatched = 1;
t/t7400-submodule-basic.sh
+12
@@ -868,4 +868,16 @@ test_expect_success 'submodule deinit fails when submodule has a .git directory
868 test -n "$(git config --get-regexp "submodule\.example\.")"
869 '
870
871 +test_expect_success 'submodule with strange name works "å äö"' '
872 + mkdir "å äö" &&
873 + (
874 + cd "å äö" &&
875 + git init &&
876 + touch sub
877 + git add sub
878 + git commit -m "init sub"
879 + )
880 + git submodule add "/å äö" &&
881 + test -n "$(git submodule | grep "å äö")"
882 +'
883 test_done