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

Re: [PATCH v2 2/3] range-diff/format-patch: handle commit ranges other than A..B

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 22, 2021, 20:32 UTC
Message-ID
<xmqqv9bo7lwd.fsf@gitster.c.googlers.com>
In-Reply-To
<2c2744333ecf5662d4198bdddeee80ff4adf6acd.1611339373.git.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 15 quoted lines
> +	i = strlen(range);
> +	c = i > 2 ? range[--i] : 0;
> +	if (c == '!')
> +		i--; /* might be ...^! */
> +	else if (isdigit(c)) {
> +		/* handle ...^-<n> */
> +		while (i > 2 && isdigit(range[--i]))
> +			; /* keep trimming trailing digits */
> +		if (i < 2 || range[i--] != '-')
> +			return 0;
> +	} else
> +		return 0;
> +
> +	/* Before the `!` or the `-<n>`, we expect `<rev>^` */
> +	return i > 0 && range[i] == '^';

This is still way too complex for my liking, but at least I cannot immediately spot a glaring off-by-one like the previous round ;-)

This is a tangent ([*1*]), but we often equate an omission to implicitly specified HEAD; e.g. "git log @{u}.." is what we did since we started building on top of our upstream. I wonder if it makes sense to allow similar short-hand so that ^! alone would mean HEAD^!, ^@ alone would mean HEAD^@, and so on.

Thanks.
[Footnote]
*1* read: this has nothing to do with how ready I think this patch
    is, but the topic reminds me of it strongly enough that I raise
    it here, because I know the opinions on this unrelated thing on
    recipients of this response are worth listening to.
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin
Message 24 of 63 in “Range diff with ranges lacking dotdot”
  1. 0/3 Range diff with ranges lacking dotdotJohannes Schindelin via GitGitGadget, Jan 21, 2021
  2. 1/3 range-diff: refactor check for commit rangeJohannes Schindelin via GitGitGadget, Jan 21, 2021
  3. Junio C HamanoJan 21, 2021
  4. Phillip WoodJan 22, 2021
  5. Junio C HamanoJan 22, 2021
  6. Phillip WoodJan 23, 2021
  7. Johannes SchindelinJan 26, 2021
  8. 2/3 range-diff: handle commit ranges other than A..BJohannes Schindelin via GitGitGadget, Jan 21, 2021
  9. Eric SunshineJan 21, 2021
  10. Johannes SchindelinJan 22, 2021
  11. Junio C HamanoJan 21, 2021
  12. Johannes SchindelinJan 22, 2021
  13. 3/3 range-diff(docs): explain how to specify commit rangesJohannes Schindelin via GitGitGadget, Jan 21, 2021
  14. Junio C HamanoJan 21, 2021
  15. Johannes SchindelinJan 22, 2021
  16. Junio C HamanoJan 22, 2021
  17. Johannes SchindelinJan 27, 2021
  18. Junio C HamanoJan 28, 2021
  19. Uwe Kleine-KönigJan 22, 2021
  20. Johannes SchindelinJan 26, 2021
  21. Uwe Kleine-KönigJan 22, 2021
  22. 0/3 Range diff with ranges lacking dotdotJohannes Schindelin via GitGitGadget, Jan 22, 2021
  23. 2/3 range-diff/format-patch: handle commit ranges other than A..BJohannes Schindelin via GitGitGadget, Jan 22, 2021
  24. Junio C HamanoJan 22, 2021
  25. Johannes SchindelinJan 27, 2021
  26. Junio C HamanoJan 28, 2021
  27. Johannes SchindelinJan 28, 2021
  28. 3/3 range-diff(docs): explain how to specify commit rangesJohannes Schindelin via GitGitGadget, Jan 22, 2021
  29. 1/3 range-diff/format-patch: refactor check for commit rangeJohannes Schindelin via GitGitGadget, Jan 22, 2021
  30. Junio C HamanoJan 22, 2021
  31. Uwe Kleine-KönigJan 25, 2021
  32. Junio C HamanoJan 25, 2021
  33. Uwe Kleine-KönigJan 25, 2021
  34. Junio C HamanoJan 26, 2021
  35. 0/3 Range diff with ranges lacking dotdotJohannes Schindelin via GitGitGadget, Jan 27, 2021
  36. 3/3 range-diff(docs): explain how to specify commit rangesJohannes Schindelin via GitGitGadget, Jan 27, 2021
  37. 2/3 range-diff/format-patch: handle commit ranges other than A..BJohannes Schindelin via GitGitGadget, Jan 27, 2021
  38. 1/3 range-diff/format-patch: refactor check for commit rangeJohannes Schindelin via GitGitGadget, Jan 27, 2021
  39. 0/3 Range diff with ranges lacking dotdotJohannes Schindelin via GitGitGadget, Feb 4, 2021
  40. 1/3 range-diff/format-patch: refactor check for commit rangeJohannes Schindelin via GitGitGadget, Feb 4, 2021
  41. Junio C HamanoFeb 4, 2021
  42. Johannes SchindelinFeb 4, 2021
  43. 2/3 range-diff/format-patch: handle commit ranges other than A..BJohannes Schindelin via GitGitGadget, Feb 4, 2021
  44. Junio C HamanoFeb 4, 2021
  45. Johannes SchindelinFeb 4, 2021
  46. Junio C HamanoFeb 4, 2021
  47. Johannes SchindelinFeb 4, 2021
  48. 3/3 range-diff(docs): explain how to specify commit rangesJohannes Schindelin via GitGitGadget, Feb 4, 2021
  49. Junio C HamanoFeb 4, 2021
  50. Johannes SchindelinFeb 4, 2021
  51. Junio C HamanoFeb 4, 2021
  52. 0/3 Range diff with ranges lacking dotdotJohannes Schindelin via GitGitGadget, Feb 4, 2021
  53. 3/3 range-diff(docs): explain how to specify commit rangesJohannes Schindelin via GitGitGadget, Feb 4, 2021
  54. 1/3 range-diff/format-patch: refactor check for commit rangeJohannes Schindelin via GitGitGadget, Feb 4, 2021
  55. 2/3 range-diff/format-patch: handle commit ranges other than A..BJohannes Schindelin via GitGitGadget, Feb 4, 2021
  56. Junio C HamanoFeb 5, 2021
  57. Junio C HamanoFeb 5, 2021
  58. Johannes SchindelinFeb 5, 2021
  59. 0/3 Range diff with ranges lacking dotdotJohannes Schindelin via GitGitGadget, Feb 5, 2021
  60. 2/3 range-diff/format-patch: handle commit ranges other than A..BJohannes Schindelin via GitGitGadget, Feb 5, 2021
  61. 3/3 range-diff(docs): explain how to specify commit rangesJohannes Schindelin via GitGitGadget, Feb 5, 2021
  62. 1/3 range-diff/format-patch: refactor check for commit rangeJohannes Schindelin via GitGitGadget, Feb 5, 2021
  63. Johannes SchindelinFeb 6, 2021

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.