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

Re: [PATCH v2 4/8] status: per-file data collection for --porcelain=v2

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 25, 2016, 20:14 UTC
Message-ID
<xmqq1t2h5vbt.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1469474750-49075-5-git-send-email-jeffhost@microsoft.com>
Jeff Hostetler <jeffhost@microsoft.com> writes:
Show 9 quoted lines
> +static void aux_updated_entry_porcelain_v2(
> +	struct wt_status *s,
> +	struct wt_status_change_data *d,
> +	struct diff_filepair *p)
> +{
> +	switch (p->status) {
> +	case DIFF_STATUS_ADDED:
> +		/* {mode,sha1}_head are zero for an add. */
> +		d->aux.porcelain_v2.mode_index = p->two->mode;

I doubt that it makes sense in the longer term to have a new "aux" field. Why isn't it part of the wt_status_change_data structure? For that matter, why should these new functions have both "aux" and "v2" in their names?

Imagine what should happen when somebody wants to add --porcelain=v3 format in 6 months. Why must "v3" be treated differently from "v1" and in a way close to "v2"? Why shouldn't all the three be treated in a similar way that "v1" has already?

Show 11 quoted lines
> +		oidcpy(&d->aux.porcelain_v2.oid_index, &p->two->oid);
> +		break;
> +
> +	case DIFF_STATUS_DELETED:
> +		d->aux.porcelain_v2.mode_head = p->one->mode;
> +		oidcpy(&d->aux.porcelain_v2.oid_head, &p->one->oid);
> +		/* {mode,oid}_index are zero for a delete. */
> +		break;
> +
> +	case DIFF_STATUS_RENAMED:
> +		d->aux.porcelain_v2.rename_score = p->score * 100 / MAX_SCORE;

I have a slight aversion against losing the precision in a helper function like this that does not do the actual output, but it probably is OK.

Don't we have copy detection score that is computed exactly the same way for DIFF_STATUS_COPIED case, too?

For readability, unless a case arm is completely empty, we should
have
		/* fallthru */
comment where "break;" would go for a normal case arm.
Show 9 quoted lines
> +	case DIFF_STATUS_COPIED:
> +	case DIFF_STATUS_MODIFIED:
> +	case DIFF_STATUS_TYPE_CHANGED:
> +	case DIFF_STATUS_UNMERGED:
> +		d->aux.porcelain_v2.mode_head = p->one->mode;
> +		d->aux.porcelain_v2.mode_index = p->two->mode;
> +		oidcpy(&d->aux.porcelain_v2.oid_head, &p->one->oid);
> +		oidcpy(&d->aux.porcelain_v2.oid_index, &p->two->oid);
> +		break;
Previous: Jeff HostetlerNext: Jeff Hostetler
Message 19 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.