From: Junio C Hamano Date: Wed, 26 Jun 2013 22:07:35 +0000 (-0700) Subject: Merge branch 'fg/submodule-non-ascii-path' X-Git-Tag: v1.8.4-rc0~127 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4f9ec8dd23ca463c4da782c11cea7a18ec111e15?ds=inline;hp=-c Merge branch 'fg/submodule-non-ascii-path' Many "git submodule" operations do 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 --- 4f9ec8dd23ca463c4da782c11cea7a18ec111e15 diff --combined git-submodule.sh index 75feaf1749,48bdf84324..eb58c8e89d --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -113,7 -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 +121,7 @@@ my ($null_sha1) = ("0" x 40); my @out = (); my $unmatched = 0; + $/ = "\0"; while () { if (/^unmatched pathspec/) { $unmatched = 1; @@@ -1129,16 -1130,16 +1130,16 @@@ cmd_status( say "-$sha1 $displaypath" continue; fi - set_name_rev "$sm_path" "$sha1" if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path" then + set_name_rev "$sm_path" "$sha1" say " $sha1 $displaypath$revname" else if test -z "$cached" then sha1=$(clear_local_git_env; cd "$sm_path" && git rev-parse --verify HEAD) - set_name_rev "$sm_path" "$sha1" fi + set_name_rev "$sm_path" "$sha1" say "+$sha1 $displaypath$revname" fi diff --combined t/t7400-submodule-basic.sh index f47cc7b604,7e23421309..71a42f0086 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@@ -78,7 -78,7 +78,7 @@@ test_expect_success 'submodule add' ( cd addtest && git submodule add -q "$submodurl" submod >actual && - test ! -s actual && + test_must_be_empty actual && echo "gitdir: ../.git/modules/submod" >expect && test_cmp expect submod/.git && ( @@@ -308,7 -308,7 +308,7 @@@ test_expect_success 'update should wor mkdir init && git submodule update -q >update.out && - test ! -s update.out && + test_must_be_empty update.out && inspect init && test_cmp expect head-sha1 @@@ -696,7 -696,7 +696,7 @@@ test_expect_success 'submodule add --na rm -rf repo && git rm repo && git submodule add -q --name repo_new "$submodurl/bare.git" repo >actual && - test ! -s actual && + test_must_be_empty actual && echo "gitdir: ../.git/modules/submod" >expect && test_cmp expect submod/.git && ( @@@ -868,4 -868,19 +868,19 @@@ test_expect_success 'submodule deinit f 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