git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 5/8] status: print per-file porcelain v2 status data

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 25, 2016, 20:23 UTC
Message-ID
<xmqqwpk94gbu.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1469474750-49075-6-git-send-email-jeffhost@microsoft.com>
Jeff Hostetler <jeffhost@microsoft.com> writes:
> +static void wt_porcelain_v2_print(struct wt_status *s);
> +

There is no point in this forward declaration, if you just place the implementation of these functions here, no?

Show 9 quoted lines
> +/*
> + * Print porcelain v2 info for tracked entries with changes.
> + */
> +static void wt_porcelain_v2_print_changed_entry(
> +	struct string_list_item *it,
> +	struct wt_status *s)
> +{
> +...
> +	fprintf(s->fp, "%c %s %s %06o %06o %06o %s %s R%d %s",

It is misleading to always say R in the output when there is no rename, isn't it?

> +	 * Note that this is a last-one-wins for each the individual
> +	 * stage [123] columns in the event of multiple cache rows
> +	 * for a stage.

Just FYI, the usual lingo we use for that is "multiple cache entries for the same stage", I would think.

Show 17 quoted lines
> +	 */
> +	memset(stages, 0, sizeof(stages));
> +	sum = 0;
> +	pos = cache_name_pos(it->string, strlen(it->string));
> +	assert(pos < 0);
> +	pos = -pos-1;
> +	while (pos < active_nr) {
> +		ce = active_cache[pos++];
> +		stage = ce_stage(ce);
> +		if (strcmp(ce->name, it->string) || !stage)
> +			break;
> +		stages[stage - 1].mode = ce->ce_mode;
> +		hashcpy(stages[stage - 1].oid.hash, ce->sha1);
> +		sum++;
> +	}
> +	if (!sum)
> +		die("BUG: unmerged entry without any stages");

Hmm, we seem to already have d->stagemask; if you call that variable "sum" anyway, perhaps its computation can be more like

	sum |= 1 << (stage - 1);
so that you can compare it with d->stagemask for this sanity check?
Previous: Jeff HostetlerNext: Jeff Hostetler
Message 8 of 20 in “status: V2 porcelain status”
  1. 0/8 status: V2 porcelain statusJeff Hostetler, Jul 25, 2016
  2. 1/8 status: rename long-format print routinesJeff Hostetler, Jul 25, 2016
  3. 2/8 status: cleanup API to wt_status_printJeff Hostetler, Jul 25, 2016
  4. Junio C HamanoJul 25, 2016
  5. 3/8 status: support --porcelain[=<version>]Jeff Hostetler, Jul 25, 2016
  6. Jakub NarębskiJul 25, 2016
  7. 5/8 status: print per-file porcelain v2 status dataJeff Hostetler, Jul 25, 2016
  8. Junio C HamanoJul 25, 2016
  9. Jeff HostetlerJul 26, 2016
  10. 7/8 status: update git-status.txt for --porcelain=v2Jeff Hostetler, Jul 25, 2016
  11. Jakub NarębskiJul 25, 2016
  12. Johannes SchindelinJul 26, 2016
  13. Jeff HostetlerJul 26, 2016
  14. 8/8 status: tests for --porcelain=v2Jeff Hostetler, Jul 25, 2016
  15. Johannes SchindelinJul 26, 2016
  16. 6/8 status: print branch info with --porcelain=v2 --branchJeff Hostetler, Jul 25, 2016
  17. Junio C HamanoJul 25, 2016
  18. 4/8 status: per-file data collection for --porcelain=v2Jeff Hostetler, Jul 25, 2016
  19. Junio C HamanoJul 25, 2016
  20. Jeff HostetlerJul 26, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.