Re: git diff ^! syntax stopped working for stashes in Git 2.28

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 12, 2022 at 4:16 AM René Scharfe <l.s.r@xxxxxx> wrote:
> Am 12.09.22 um 11:57 schrieb Tim Jaacks:
>> I noticed that the following syntax to show the changes of a stash stopped working in Git 2.28:
>>
>>   git diff stash@{0}^!

> Bisects to 8bfcb3a690 (git diff: improve range handling, 2020-06-12).

It's not really clear to me what `git diff stash^!` (and similar) *should* do.
That it worked before was at least in part an accident of implementation.

> A stash revision is a merge.  With "stash@{0}^!" it ends up in
> ent.objects[2] and its parents (marked UNINTERESTING) in ent.objects[0]
> and ent.objects[1].

Right: the ^! suffix produces a negated list of the children as additional
revs (with the stash itself as the lone positive rev).  Note that a stash
made with `-u` will list *three* such revs rather than just two, since such
a stash is a three-parent merge.

You're advised (in the git stash documentation) to use `git stash show`,
not `git diff`, to get a diff from the stash's parent commit to the stash's
working-tree commit.

It's certainly possible to detect a single positive rev and two or three
negative ones as special cases here, but it's not clear that this is a
good idea.  Note that in commit bafa2d741e I made one
of the tests stop using `git diff HEAD^!` on the grounds that it's not
defined behavior.

Chris




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux