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

Re: [PATCH 2/2] Fix ranges with git-show

From
Thomas Rast <trast@inf.ethz.ch>
Date
Jun 20, 2012, 07:39 UTC
Message-ID
<87bokexwiq.fsf@thomas.inf.ethz.ch>
In-Reply-To
<7vhau7ypk6.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> I do not think it is sad at all.  If we were told to walk, we should
> walk just like "git log" does, and otherwise we just show them one
> by one.  It might be even cleaner if we separate the command line
> parsing and showing into separate phases, instead of the current
> loop structure of parsing one object and deciding how to show.
>
> How about doing it this way without applying your 2/2?
[...]
Show 9 quoted lines
>  	opt.tweak = show_rev_tweak_rev;
>  	cmd_log_init(argc, argv, prefix, &rev, &opt);
>  
> +	if (!rev.no_walk)
> +		return cmd_log_walk(&rev);
> +
>  	count = rev.pending.nr;
>  	objects = rev.pending.objects;
>  	for (i = 0; i < count && !ret; i++) {

Clever. But it eliminates all possibility of *simultaneously* showing a range and some other objects, of which

Show 7 quoted lines
> Among your new tests:
>
> 	git show ^side3 annotated
>
> must change, as it is not asking to show individual objects (in
> other words, I think the test expects a wrong thing), but everything
> else should work as expected (I didn't check).

is just a symptom of. Do you want to change it? I'd be all for it, but it changes the meaning somewhat. So far, showing "anything plus ranges" is broken only as far as the ranges are concerned.

If you do make this change, can we merge the log and show code? Granted, show defaults to -p --cc --no-walk, and log does not, but can we then unify the main logic?

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 7 in “Demonstrate git-show is broken with ranges”
  1. 1/2 Demonstrate git-show is broken with rangesThomas Rast, Jun 19, 2012
  2. 2/2 Fix ranges with git-showThomas Rast, Jun 19, 2012
  3. Junio C HamanoJun 19, 2012
  4. Junio C HamanoJun 19, 2012
  5. Junio C HamanoJun 19, 2012
  6. Thomas RastJun 20, 2012
  7. Junio C HamanoJun 20, 2012

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.