All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff Hostetler <git@jeffhostetler.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, 05 Aug 2016 10:01:06 -0700	[thread overview]
Message-ID: <xmqqd1lnxi99.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1470147137-17498-7-git-send-email-git@jeffhostetler.com> (Jeff Hostetler's message of "Tue, 2 Aug 2016 10:12:15 -0400")

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?

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.

Thanks.

  reply	other threads:[~2016-08-05 17:01 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 [this message]
2016-08-05 18:11     ` Jeff Hostetler
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

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

  git send-email \
    --in-reply-to=xmqqd1lnxi99.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --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.
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.