public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Matthew Rothenberg <mrothenberg@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: Efficient parsing of `status -z` output
Date: Sun, 08 Mar 2015 00:14:06 -0800	[thread overview]
Message-ID: <xmqqlhj7sy7l.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAMJduDuxBDoJ9_ETY8FCRoANf+taAS7-1acf5CFRGXDFyL72Rg@mail.gmail.com> (Matthew Rothenberg's message of "Sat, 7 Mar 2015 18:00:42 -0500")

Matthew Rothenberg <mrothenberg@gmail•com> writes:

>  2. Read from buffer until the first NUL, parse the entry status
> codes, and if the entry status code represents a status that *should*
> have multiple filenames, read from buffer until a second NUL is found,
> and then reparse that entry with both filenames. The issues I see with
> this approach:
>    a.) One has to know exactly which status code combinations will end
> up with two filenames, and this list has to be exhaustive. As far as I
> can tell, there is no canonical documentation for this?
>    b.) It seems a bit brittle, because if the logic from the above is
> wrong and we miss an extended entry or ask for one when it doesn't
> exist we will leave the buffer an essentially corrupt state for future
> reads.

I think this is how -z was designed to be used, and if that isn't
clear, then the documentation must be updated to clarify.  Rename
and Copy are the only ones that needs two pathnames, and I suspect
that whoever did the original description of the short format in the
documentation knew Git too well that he forgot to mention it ;-)

  reply	other threads:[~2015-03-08  8:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07 23:00 Efficient parsing of `status -z` output Matthew Rothenberg
2015-03-08  8:14 ` Junio C Hamano [this message]
2015-03-09  1:41   ` Matthew Rothenberg
2015-03-09  6:19     ` Jeff King
2015-03-09  6:49       ` Jeff King
2015-03-09 23:40         ` Matthew Rothenberg
2015-03-10  5:41           ` Jeff King

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=xmqqlhj7sy7l.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=mrothenberg@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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