git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Fredrik Gustafsson <iveqy@iveqy.com>
Cc: git@vger.kernel.org, jens.lehmann@web.de, hvoigt@hvoigt.net
Subject: Re: [PATCH 1/2] submodule: handle multibyte characters in name
Date: Wed, 12 Jun 2013 14:06:23 -0700	[thread overview]
Message-ID: <7vppvr11kg.fsf_-_@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1370991854-1414-2-git-send-email-iveqy@iveqy.com> (Fredrik Gustafsson's message of "Wed, 12 Jun 2013 01:04:13 +0200")

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.

>  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;

  reply	other threads:[~2013-06-12 21:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 23:04 [PATCH 0/2] module_list enhancements Fredrik Gustafsson
2013-06-11 23:04 ` [PATCH 1/2] [submodule] handle multibyte characters in name Fredrik Gustafsson
2013-06-12 21:06   ` Junio C Hamano [this message]
2013-06-12 21:38     ` [PATCH 1/2] submodule: " Jens Lehmann
2013-06-12 22:57       ` Junio C Hamano
2013-06-12 23:10         ` Fredrik Gustafsson
2013-06-13  1:41   ` [PATCH 1/2] [submodule] " Phil Hord
2013-06-11 23:04 ` [PATCH 2/2] [submodule] Replace perl-code with sh Fredrik Gustafsson
2013-06-12 21:08   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vppvr11kg.fsf_-_@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --cc=iveqy@iveqy.com \
    --cc=jens.lehmann@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).