From: Jeff Hostetler <git@jeffhostetler.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes.Schindelin@gmx.de,
Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH v4 6/8] status: print branch info with --porcelain=v2 --branch
Date: Fri, 5 Aug 2016 14:11:16 -0400 [thread overview]
Message-ID: <57A4D6C4.3010501@jeffhostetler.com> (raw)
In-Reply-To: <xmqqd1lnxi99.fsf@gitster.mtv.corp.google.com>
On 08/05/2016 01:01 PM, Junio C Hamano wrote:
> Jeff Hostetler <git@jeffhostetler.com> writes:
>
>> /*
>> + * Print branch information for porcelain v2 output. These lines
>> + * are printed when the '--branch' parameter is given.
>> + *
>> + * # branch.oid <commit><eol>
>> + * # branch.head <head><eol>
>
> Just bikeshedding, but ...
>
>> + if (!s->branch)
>> + fprintf(s->fp, "# branch.head %s%c", "(unknown)", eol);
>> + else {
>> + if (!strcmp(s->branch, "HEAD")) {
>> + fprintf(s->fp, "# branch.head %s%c", "(detached)", eol);
>> +
>> + if (state.rebase_in_progress || state.rebase_interactive_in_progress)
>> + branch_name = state.onto;
>> + else if (state.detached_from)
>> + branch_name = state.detached_from;
>> + else
>> + branch_name = "";
>> + } else {
>> + branch_name = NULL;
>> + skip_prefix(s->branch, "refs/heads/", &branch_name);
>> +
>> + fprintf(s->fp, "# branch.head %s%c", branch_name, eol);
>
> ... given that we are showing branch name, perhaps "branch.name"
> instead of "branch.head" is more appropriate?
Either way is fine with me. I just saw your comments on
commit v4-7/8. And leaving it as is is fine.
>
> I wondered if "# " prefix before these lines is useful, by the way,
> and initially thought that the fact that these lines begin with
> "branch." and not with the "1/2/u $key" sufficient clue for whoever
> reads them, but the reader can tell which kind of record it is by
> reading the first two characters of each line (i.e. if "# " that is
> not the usual "change info for a single file"), so it is actually a
> good idea.
Yes, I used the "#" prefix to indicate a header line so that
parsers can always look at the first character and decide.
I set it up so the "--branch" argument creates "# branch.*" headers.
In my first patch series, I included worktree state information
(such as in-a-rebase and the rebase step counts), but it was thought
that that should be an independent effort. So, using this model,
if we later do add a "--state" argument, it would create "# state.*"
headers. And we would not have to change the --porcelain=v2 version
number.
Jeff
next prev parent reply other threads:[~2016-08-05 18:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 14:12 [PATCH v4 0/8] status: V2 porcelain status Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 1/8] status: rename long-format print routines Jeff Hostetler
2016-08-03 21:28 ` Junio C Hamano
2016-08-04 12:30 ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 2/8] status: cleanup API to wt_status_print Jeff Hostetler
2016-08-03 21:36 ` Junio C Hamano
2016-08-04 12:35 ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 3/8] status: support --porcelain[=<version>] Jeff Hostetler
2016-08-03 21:37 ` Junio C Hamano
2016-08-02 14:12 ` [PATCH v4 4/8] status: per-file data collection for --porcelain=v2 Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 5/8] status: print per-file porcelain v2 status data Jeff Hostetler
2016-08-05 21:02 ` Jeff King
2016-08-05 21:09 ` Junio C Hamano
2016-08-05 21:14 ` Jeff King
2016-08-05 21:21 ` Junio C Hamano
2016-08-05 21:43 ` Stefan Beller
2016-08-05 21:47 ` Stefan Beller
2016-08-05 21:27 ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 6/8] status: print branch info with --porcelain=v2 --branch Jeff Hostetler
2016-08-05 17:01 ` Junio C Hamano
2016-08-05 18:11 ` Jeff Hostetler [this message]
2016-08-02 14:12 ` [PATCH v4 7/8] git-status.txt: describe --porcelain=v2 format Jeff Hostetler
2016-08-05 17:50 ` Junio C Hamano
2016-08-05 18:27 ` Jeff Hostetler
2016-08-02 14:12 ` [PATCH v4 8/8] status: tests for --porcelain=v2 Jeff Hostetler
2016-08-05 18:12 ` Junio C Hamano
2016-08-05 18:31 ` Jeff Hostetler
2016-08-03 15:09 ` [PATCH v4 0/8] status: V2 porcelain status Johannes Schindelin
2016-08-03 15:23 ` Junio C Hamano
2016-08-03 16:10 ` Johannes Schindelin
2016-08-03 16:59 ` 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=57A4D6C4.3010501@jeffhostetler.com \
--to=git@jeffhostetler.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
/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).