All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Don Zickus <dzickus@gmail.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: Fix "git log -z" behaviour
Date: Fri, 09 Feb 2007 23:32:10 -0800	[thread overview]
Message-ID: <7vtzxumps5.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7v7iusz3c2.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Thu, 08 Feb 2007 14:34:05 -0800")

Junio C Hamano <junkio@cox.net> writes:

> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
>> For the normal case where the termination character is '\n', this 
>> obviously doesn't change anything at all, since we just switched two 
>> identical characters around. So it's very safe - it doesn't change any 
>> normal usage, but it definitely fixes "git log -z".
>
> Gaah.
>
> I have already applied this but I think this has fallout for
> existing users of "-z --raw".  Nothing in-tree uses "git log" as
> the upstream of a pipe as far as I know because in-tree stuff
> tend to stick to plumbing when it comes to scripting, but I
> think your patch would affect the plumbing level as well.

I think the new semantics for -z ("inter-record termination is
NUL") makes a lot more sense for "-p -z" format that shows
commit log message and the patch text.  It makes filtering the
output with "grep -z" feel much more natural.

The new semantics is however quite inconsistent with the other
formats: --raw, --name-only and --name-status.  These already
use NUL for separating pathnames and fields when -z is given, in
order to allow scripts sensibly deal with pathname that contain
funny characters (e.g. LF and HT).  Nobody is likely to feed
their output to "grep -z", but one problematic case I see is to
use this:

	git log -z --raw -r --pretty=raw $commit

or its equivalent:

	git rev-list $commit |
        git diff-tree --stdin --raw -r --pretty=raw

to prepare data to feed something like fast-import.

But such newly written scripts can read from non -z and unwrap
paths themselves just as easily (the pathname safety with NUL
was invented before we started using c-quote consistently), so
it might be Ok to leave them (slightly) broken.

So, I give up.

  reply	other threads:[~2007-02-10  7:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-07 16:41 git log filtering Don Zickus
2007-02-07 16:55 ` Jakub Narebski
2007-02-07 17:01 ` Uwe Kleine-König
2007-02-07 17:12   ` Johannes Schindelin
2007-02-07 17:12 ` Linus Torvalds
2007-02-07 17:25   ` Johannes Schindelin
     [not found]     ` <7v64ad7l12.fsf@assigned-by-dhcp.cox.net>
2007-02-07 21:03       ` Linus Torvalds
2007-02-07 21:09         ` Junio C Hamano
2007-02-07 21:53           ` Linus Torvalds
2007-02-08  6:16             ` Jeff King
2007-02-08 18:06               ` Johannes Schindelin
2007-02-08 22:33                 ` Jeff King
2007-02-09  0:18                   ` Johannes Schindelin
2007-02-09  0:23                     ` Shawn O. Pearce
2007-02-09  0:45                       ` Johannes Schindelin
2007-02-09 10:15                       ` Sergey Vlasov
2007-02-09  1:59                     ` Jeff King
2007-02-09 13:13                       ` Johannes Schindelin
2007-02-09 13:22                         ` Jeff King
2007-02-09 15:02                           ` Johannes Schindelin
2007-03-07 17:37               ` pcre performance, was " Johannes Schindelin
2007-03-07 18:03                 ` Paolo Bonzini
2007-02-08  1:59         ` Horst H. von Brand
2007-02-07 18:16   ` Linus Torvalds
2007-02-07 19:49     ` Fix "git log -z" behaviour Linus Torvalds
2007-02-07 19:55       ` Junio C Hamano
2007-02-07 22:53       ` Don Zickus
2007-02-07 23:05         ` Linus Torvalds
2007-02-08 22:34       ` Junio C Hamano
2007-02-10  7:32         ` Junio C Hamano [this message]
2007-02-10  9:36           ` Junio C Hamano
2007-02-10 17:09             ` Linus Torvalds
2007-02-07 18:19   ` git log filtering Don Zickus
2007-02-07 18:27     ` Linus Torvalds

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=7vtzxumps5.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=dzickus@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.