git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] [submodule] handle multibyte characters in name

From
Fredrik Gustafsson <iveqy@iveqy.com>
Date
Jun 11, 2013, 23:04 UTC
Message-ID
<1370991854-1414-2-git-send-email-iveqy@iveqy.com>
In-Reply-To
<1370991854-1414-1-git-send-email-iveqy@iveqy.com>

Bugg reported here: http://thread.gmane.org/gmane.comp.version-control.git/218922/focus=226791

Note that newline (\n) is still not supported and will not be until the sh-script is replaced by something in an other language. This however let us to use mostly all other strange characters.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
---
 git-submodule.sh           | 3 ++-
 t/t7400-submodule-basic.sh | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 79bfaac..31524d3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -113,9 +113,10 @@ resolve_relative_url ()
 module_list()
 {
 	(
-		git ls-files --error-unmatch --stage -- "$@" ||
+		git ls-files --error-unmatch --stage -z -- "$@" ||
 		echo "unmatched pathspec exists"
 	) |
+	sed -e 's/\x00/\n/g' |
 	perl -e '
 	my %unmerged = ();
 	my ($null_sha1) = ("0" x 40);
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index ff26535..47ab7e7 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -868,4 +868,9 @@ 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 strange name works "å äö"' '
+	git init "å äö" &&
+	git submodule add "./å äö" &&
+	test -n "$(cat .gitmodules | grep "å äö")"
+'
 test_done
-- 
1.8.3.253.g20b40b5.dirty
Previous: Fredrik GustafssonNext: Junio C Hamano
Message 2 of 9 in “module_list enhancements”
  1. 0/2 module_list enhancementsFredrik Gustafsson, Jun 11, 2013
  2. 1/2 [submodule] handle multibyte characters in nameFredrik Gustafsson, Jun 11, 2013
  3. Junio C HamanoJun 12, 2013
  4. Jens LehmannJun 12, 2013
  5. Junio C HamanoJun 12, 2013
  6. Fredrik GustafssonJun 12, 2013
  7. Phil HordJun 13, 2013
  8. 2/2 [submodule] Replace perl-code with shFredrik Gustafsson, Jun 11, 2013
  9. Junio C HamanoJun 12, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.