Skip to content

Commit 7467124

Browse files
iveqygitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent edca415 commit 7467124

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,4 +868,16 @@ 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 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+
'
871883
test_done

0 commit comments

Comments
 (0)