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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 12, 2013, 21:06 UTC
Message-ID
<7vppvr11kg.fsf_-_@alter.siamese.dyndns.org>
In-Reply-To
<1370991854-1414-2-git-send-email-iveqy@iveqy.com>
Fredrik Gustafsson <iveqy@iveqy.com> writes:
> Bugg reported here:
> http://thread.gmane.org/gmane.comp.version-control.git/218922/focus=226791

The URL is nice supplemental info as footnote, but please write log message in a way that a reader can understand without going there. In this case, it wouldn't be so hard, I think, perhaps like:

	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.
	Read from "git ls-files -z" instead, which is easier than
	unwrapping C-quote ourselves.
or something.
Show 8 quoted lines
>  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' |

It is strange to preprosess input to be read by a Perl script with sed ;-)

How about doing it this way instead? Does the result pass your test?

 git-submodule.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 79bfaac..19faf58 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 ls-files --error-unmatch --stage -z -- "$@" ||
 		echo "unmatched pathspec exists"
 	) |
 	perl -e '
@@ -121,6 +121,7 @@ module_list()
 	my ($null_sha1) = ("0" x 40);
 	my @out = ();
 	my $unmatched = 0;
+	$/ = "\0";
 	while (<STDIN>) {
 		if (/^unmatched pathspec/) {
 			$unmatched = 1;
Previous: Fredrik GustafssonNext: Jens Lehmann
Message 3 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.