Merge branch 'fg/submodule-non-ascii-path' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 15 Jul 2013 17:35:17 +0000 (10:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Jul 2013 17:35:17 +0000 (10:35 -0700)
Many "git submodule" operations did not work on a submodule at a
path whose name is not in ASCII.

* fg/submodule-non-ascii-path:
t7400: test of UTF-8 submodule names pass under Mac OS
handle multibyte characters in name

git-submodule.sh
t/t7400-submodule-basic.sh
index 79bfaac9d4cb9a04e5e1fd7675d740cf9fc27e87..48bdf843244503df247e0dbdef3c5541cd9eb48e 100755 (executable)
@@ -113,7 +113,7 @@ resolve_relative_url ()
 module_list()
 {
        (
-               git ls-files --error-unmatch --stage -- "$@" ||
+               git ls-files -z --error-unmatch --stage -- "$@" ||
                echo "unmatched pathspec exists"
        ) |
        perl -e '
@@ -121,6 +121,7 @@ module_list()
        my ($null_sha1) = ("0" x 40);
        my @out = ();
        my $unmatched = 0;
+       $/ = "\0";
        while (<STDIN>) {
                if (/^unmatched pathspec/) {
                        $unmatched = 1;
index ff265353a375d02bb578fed29ea00f07dc08a6fc..7e2342130938c4d476f7d97464da9d8388479d98 100755 (executable)
@@ -868,4 +868,19 @@ test_expect_success 'submodule deinit fails when submodule has a .git directory
        test -n "$(git config --get-regexp "submodule\.example\.")"
 '
 
+test_expect_success 'submodule with UTF-8 name' '
+       svname=$(printf "\303\245 \303\244\303\266") &&
+       mkdir "$svname" &&
+       (
+               cd "$svname" &&
+               git init &&
+               >sub &&
+               git add sub &&
+               git commit -m "init sub"
+       ) &&
+       test_config core.precomposeunicode true &&
+       git submodule add ./"$svname" &&
+       git submodule >&2 &&
+       test -n "$(git submodule | grep "$svname")"
+'
 test_done