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

Re: [PATCH] [GSoC][MICRO] Forbid "log --graph --no-walk"

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 6, 2015, 18:51 UTC
Message-ID
<xmqqioeeyn6q.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CABwkPcoBG61YY0N4b33gdMq2cC1oQ_wFV7KaGGu3wYfuY9inGw@mail.gmail.com>
Dongcan Jiang <dongcan.jiang@gmail.com> writes:
Show 7 quoted lines
> At first, I also tried to only judge the value of "revs->no_walk &&
> revs->graph", but unfortunately, it failed to pass all cases in
> t4052-stat-output.sh.
> e.g. command "git show --stat --graph" failed to get the correct result.
>
> Finally, this is because that "revs->no_walk" gets set when it comes
> to "git show --stat".

When "git show" is given a range, it turns no-walk off and becomes a command about a connected history. Otherwise, it is a command about discrete point(s).

Because "git show --graph A B C" and "git log --graph --no-walk A B C" are moral equivalents, if we are forbidding the latter, we should forbid the former.

"git show A" (and no other revs, just a single point), however, could be thought of as an equivalent for "git log -1 A", even though that interpretation is based on a wrong world view (because "show one and stop" is not the reason why the result "git show A" gives has only A and nothing else). And it makes sort of sense to allow "git show --graph A" that is an equivalent to "git log -1 --graph A" under that interpretation.

I was tempted to say the existing test is wrong to expect that "--graph" does anything meaningful for "git show" that is run for a non-range. But doing the "use of both is wrong for log" change without special casing "show" (and instead "fixing" t4052) would be a change in behaviour, which we try to avoid in general.

I'd prefer a solution that does not waste a new bit in revision structure in general, but if we were to waste one bit to special case "show", it shouldn't be "fail only for the log command". It should be "allow this stupidity only for the show command for backward compatibility" bit instead, I think.

Previous: Dongcan JiangNext: René Scharfe
Message 4 of 13 in “[GSoC][MICRO] Forbid "log --graph --no-walk"”
  1. [GSoC][MICRO] Forbid "log --graph --no-walk"Dongcan Jiang, Mar 6, 2015
  2. Eric SunshineMar 6, 2015
  3. Dongcan JiangMar 6, 2015
  4. Junio C HamanoMar 6, 2015
  5. René ScharfeMar 6, 2015
  6. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 7, 2015
  7. Junio C HamanoMar 8, 2015
  8. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 9, 2015
  9. Junio C HamanoMar 10, 2015
  10. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 11, 2015
  11. Junio C HamanoMar 17, 2015
  12. Eric SunshineMar 17, 2015
  13. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 18, 2015

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.