From: Junio C Hamano <gitster@pobox.com>
To: Rogan Dawes <rogan@dawes.za.net>, "Theodore Ts'o" <tytso@mit.edu>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Allow git-mergetool to handle paths with a leading space
Date: Mon, 07 Jan 2008 01:09:45 -0800 [thread overview]
Message-ID: <7v8x320zom.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <4781D6C2.9060305@dawes.za.net> (Rogan Dawes's message of "Mon, 07 Jan 2008 09:37:38 +0200")
Rogan Dawes <rogan@dawes.za.net> writes:
> Yes, you are right. Maybe setting IFS to the empty string is better?
Yes. POSIX XCU "2.6.5 Field Splitting" is quite clear about
this. Empty IFS tells read not to split the fields, and such an
IFS does not have IFS white space in it so the SP at the
beginning of the input will not be stripped.
My limited test indicates that bash, dash and ksh do behave as
specified, so I think it is a reasonably safe thing to do.
Although I usually would say "I do not care about Solaris
default /bin/sh", I know even that shell at least gets this
right.
I think the patch is Ok as long as the user does not care any
character outside the portable filename character set (POSIX XBD
3.276) other than SP. Because the rest of the mergetool is
written in such a way that it does not handle many characters
outside the portable filename character set well anyway, I think
the filename limitation that still remains after your patch may
be acceptable.
I did not however apply your patch to my tree tonight, as Ted as
the original and the primary author of the script may have
better ideas, and/or future directions for the patch. He can
simply just Ack your patch if he chooses to.
I'd however write that overly long pipeline indented a bit more
sanely, like this, though:
git ls-files -u |
sed -e 's/^[^ ]* //' |
sort -u |
while IFS="" read i
do
printf "\n"
merge_file "$i" </dev/tty >/dev/tty
...
In the longer term, I'd probably suggest redoing the entire
command in a NUL safe scripting language (or even C, especially
if pressed by mingw or msys folks) to eliminate the issue
altogether, though. But that would definitely be a post 1.5.4
item.
[Reference]
http://www.opengroup.org/onlinepubs/000095399/toc.htm
next prev parent reply other threads:[~2008-01-07 9:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-06 9:25 [PATCH] Allow git-mergetool to handle paths with a leading space Rogan Dawes
2008-01-06 10:18 ` Junio C Hamano
2008-01-06 10:51 ` Rogan Dawes
2008-01-06 11:48 ` Junio C Hamano
2008-01-07 7:37 ` Rogan Dawes
2008-01-07 9:09 ` Junio C Hamano [this message]
2008-01-08 1:19 ` Theodore Tso
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v8x320zom.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=rogan@dawes.za.net \
--cc=tytso@mit.edu \
/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.
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 NNTP newsgroup(s).