git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] "git range-diff" does not know X^! is a valid range
@ 2024-04-02 17:45 Junio C Hamano
  2024-04-02 20:24 ` René Scharfe
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2024-04-02 17:45 UTC (permalink / raw)
  To: git

When cherry-picking an existing commit X to a different base, which
may have resulted in conflicts that needed a fix-up, you would want
to be able to compare X~1..X and HEAD~1..HEAD and naturally, we
would expect "range-diff" to have a handy way to allow giving the
command without having to type the overly long branch name X twice.

Individual "diff" for these two ranges are easy to obtain without
repeating X:

    $ git diff X^!
    $ git diff HEAD^!

The "git range-diff" however does not understand that X^! is a valid
range X~1..X.  This command throws an error and ...

    $ git range-diff refs/merge-fix/ew/khash-to-khashl^! HEAD^!
    fatal: need two commit ranges

... to add insult to injury, it shows the huge "git range-diff -h"
output after that.

Any takers?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] "git range-diff" does not know X^! is a valid range
  2024-04-02 17:45 [BUG] "git range-diff" does not know X^! is a valid range Junio C Hamano
@ 2024-04-02 20:24 ` René Scharfe
  2024-04-02 20:37   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: René Scharfe @ 2024-04-02 20:24 UTC (permalink / raw)
  To: Junio C Hamano, git

Am 02.04.24 um 19:45 schrieb Junio C Hamano:
> When cherry-picking an existing commit X to a different base, which
> may have resulted in conflicts that needed a fix-up, you would want
> to be able to compare X~1..X and HEAD~1..HEAD and naturally, we
> would expect "range-diff" to have a handy way to allow giving the
> command without having to type the overly long branch name X twice.
>
> Individual "diff" for these two ranges are easy to obtain without
> repeating X:
>
>     $ git diff X^!
>     $ git diff HEAD^!
>
> The "git range-diff" however does not understand that X^! is a valid
> range X~1..X.  This command throws an error and ...
>
>     $ git range-diff refs/merge-fix/ew/khash-to-khashl^! HEAD^!
>     fatal: need two commit ranges

Seems to work fine in this example:

   $ git range-diff refs/remotes/origin/maint^! HEAD^!
   -:  ---------- > 1:  c2cbfbd2e2 The thirteenth batch

Are your refs valid?  Does "git rev-parse" resolve them properly?

is_range_diff_range() uses setup_revisions(); not sure how it could
misparse "X^!". :-?

> ... to add insult to injury, it shows the huge "git range-diff -h"
> output after that.

Yeah, that's annoying in general, I guess to anyone who has seen it
before or knows that -h or --help will list options.  Drowns out the
actual signal.

René


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] "git range-diff" does not know X^! is a valid range
  2024-04-02 20:24 ` René Scharfe
@ 2024-04-02 20:37   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2024-04-02 20:37 UTC (permalink / raw)
  To: René Scharfe; +Cc: git

René Scharfe <l.s.r@web.de> writes:

> Seems to work fine in this example:
>
>    $ git range-diff refs/remotes/origin/maint^! HEAD^!
>    -:  ---------- > 1:  c2cbfbd2e2 The thirteenth batch
>
> Are your refs valid?  Does "git rev-parse" resolve them properly?

Ah, HEAD^! was typoed without SHIFT key.  Sorry for the noise.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-02 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 17:45 [BUG] "git range-diff" does not know X^! is a valid range Junio C Hamano
2024-04-02 20:24 ` René Scharfe
2024-04-02 20:37   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).