Skip to content

Commit 1f101bf

Browse files
committed
Merge branch 'fg/submodule-non-ascii-path' into maint
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
2 parents 1b79021 + bed9470 commit 1f101bf

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

git-submodule.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,15 @@ resolve_relative_url ()
113113
module_list()
114114
{
115115
(
116-
git ls-files --error-unmatch --stage -- "$@" ||
116+
git ls-files -z --error-unmatch --stage -- "$@" ||
117117
echo "unmatched pathspec exists"
118118
) |
119119
perl -e '
120120
my %unmerged = ();
121121
my ($null_sha1) = ("0" x 40);
122122
my @out = ();
123123
my $unmatched = 0;
124+
$/ = "\0";
124125
while (<STDIN>) {
125126
if (/^unmatched pathspec/) {
126127
$unmatched = 1;

t/t7400-submodule-basic.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,4 +868,19 @@ test_expect_success 'submodule deinit fails when submodule has a .git directory
868868
test -n "$(git config --get-regexp "submodule\.example\.")"
869869
'
870870

871+
test_expect_success 'submodule with UTF-8 name' '
872+
svname=$(printf "\303\245 \303\244\303\266") &&
873+
mkdir "$svname" &&
874+
(
875+
cd "$svname" &&
876+
git init &&
877+
>sub &&
878+
git add sub &&
879+
git commit -m "init sub"
880+
) &&
881+
test_config core.precomposeunicode true &&
882+
git submodule add ./"$svname" &&
883+
git submodule >&2 &&
884+
test -n "$(git submodule | grep "$svname")"
885+
'
871886
test_done

0 commit comments

Comments
 (0)