Bug: Merge commits confuse `log -r`
JakobDegen opened this issue · comments
Steps to reproduce:
$ cat setup.sh
cd /tmp
sl init --git example && cd example
touch x && sl commit -m 'initial' --addremove
echo abc > x && sl commit -m 'modify'
sl prev
touch y && sl commit -m 'unrelated' --addremove
sl merge 'desc(modify)'
sl commit -m 'merge'
$ ./setup.sh
$ cd /tmp/example
$ sl log -T '{node} {desc}\n' x
a0e5bd5c4f2eb74a8516230fda8a3502c4be8314 modify
3a02debe2692aa0a5f8d63fbb1b0a1e186584874 initial
$ sl log -T '{node} {desc}\n' x -r '::.'
3a02debe2692aa0a5f8d63fbb1b0a1e186584874 initial
I believe this is a bug. I expected the output to not change when specifying -r '::.'
as that is the default value as per the docs. Also, this does not match the behavior when using --all
(instead of specifying a file):
$ sl log -T '{node} {desc}\n' --all
87c5f51ce86cc937c60bd2c99eed4c09c829bdb7 merge
e20468cbdc385eb749ba005292d177c68647af00 unrelated
a0e5bd5c4f2eb74a8516230fda8a3502c4be8314 modify
3a02debe2692aa0a5f8d63fbb1b0a1e186584874 initial
$ sl log -T '{node} {desc}\n' --all -r '::.'
3a02debe2692aa0a5f8d63fbb1b0a1e186584874 initial
a0e5bd5c4f2eb74a8516230fda8a3502c4be8314 modify
e20468cbdc385eb749ba005292d177c68647af00 unrelated
87c5f51ce86cc937c60bd2c99eed4c09c829bdb7 merge
Metadata
$ sl --version
Sapling 0.2.20230523-092610+f12b7eee
I don't have convenient access to a master build right now, so can't test there unfortunately.
Ah, there was a bug in my previous testing. This does not require git to reproduce, and making the same commits in a normal sl repo shows this behavior too
Edit: Updated the top comment to reflect this fact
This reproduces similarly with explicit "ancestors(.)"
and "ancestors($(sl whereami))"