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

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

From
Fredrik Gustafsson <iveqy@iveqy.com>
Date
Jun 14, 2013, 00:26 UTC
Message-ID
<1371169563-10267-2-git-send-email-iveqy@iveqy.com>
In-Reply-To
<1371169563-10267-1-git-send-email-iveqy@iveqy.com>

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.

Solution-suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
---
 git-submodule.sh           |  2 +-
 t/t7400-submodule-basic.sh | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 79bfaac..bad051e 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -113,7 +113,7 @@ resolve_relative_url ()
 module_list()
 {
 	(
-		git ls-files --error-unmatch --stage -- "$@" ||
+		git -c core.quotepath=false ls-files --error-unmatch --stage -- "$@" ||
 		echo "unmatched pathspec exists"
 	) |
 	perl -e '
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index ff26535..d5743ee 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -868,4 +868,16 @@ 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 "å äö"' '
+	mkdir "å äö" &&
+	(
+		cd "å äö" &&
+		git init &&
+		touch sub
+		git add sub
+		git commit -m "init sub"
+	)
+	git submodule add "/å äö" &&
+	test -n "$(git submodule | grep "å äö")"
+'
 test_done
-- 
1.8.3.1.381.g2ab719e.dirty
Previous: Fredrik GustafssonNext: Junio C Hamano
Message 2 of 4 in “module_list enhancements”
  1. 0/2 module_list enhancementsFredrik Gustafsson, Jun 14, 2013
  2. 1/2 [submodule] handle multibyte characters in nameFredrik Gustafsson, Jun 14, 2013
  3. Junio C HamanoJun 14, 2013
  4. 2/2 [submodule] Replace perl-code with shFredrik Gustafsson, Jun 14, 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.