Subject: Re: [PATCH/RFC] range-diff: make output format more useful for "rebase --onto"

From: Taylor Blau <[email-masked]>
Date: Fri, 17 Sep 2021 23:29:53 -0400

On Fri, Sep 17, 2021 at 04:04:01PM -0700, Junio C Hamano wrote:
> In a range-diff output, we often see an early part of an updated
> series having no changes since the previous iteration.  After
> applying an updated patch submission to the same base as the
> previous round,
>
>     $ git range-diff master..topic@{1} master..topic
>
> to view the differences since the previous edition, we might see
> something like this:
>
> [...]

Hmm... looks familiar :).

> The updated output format looks like this instead:
>
>     1 = 1 a05f02b1d9 a05f02b1d9 : t/helper/test-bitmap.c: add  ...
>     2 = 2 8de300e1f7 8de300e1f7 : pack-bitmap.c: propagate nam ...
>     3 = 3 caca3c9f07 caca3c9f07 : midx.c: respect 'pack.writeB ...
>     4 = 4 2082224f17 2082224f17 : p5326: create missing 'perf- ...
>     5 = 5 97b89c8150 97b89c8150 : p5326: don't set core.multiP ...
>     6 < - a1dd4c97b9 ---------- : p5326: generate pack bitmaps ...
>     - > 6 ---------- bf4a60874a : p5326: generate pack bitmaps ...
>     7 ! 7 2b909ebad3 54156af0d6 : t5326: test propagating hash ...
> 	@@ t/t5326-multi-pack-bitmaps.sh: test_expect_success 'pack.preferBitmapTips' '
> 	 +	(
> 	 +		cd repo &&

I do not feel strongly about either format, and can understand an appeal
for both. I think that I find the existing format a little clearer to
read, but it's possible that I'm just biased since it's always been
that way.

But I can equally understand why it would be nicer to have both hashes
next to each other separated by whitespace.

I also don't care to make it configurable, or to work on more flexible
formatting options for range-diff. I would be fine with the proposed
format. As an alternative, something like this could work:

  perl -ale 'if (@F[2] ne "=") { print "$l $r"; exit }; $l = @F[1]; $r = @F[4]'

when piped the output of range-diff with --no-patch. That gives you
empty output when the two series aren't related, which may or may not be
what you want.

Thanks,
Taylor