Copying multiple hashes yields incorrect dotted range on nonlinear histories and consecutive selections

Describe the bug
Copying multiple hashes that are consecutive in the gitui revlog display yields incorrect dotted range if the commit history is not linear.

To Reproduce
Steps to reproduce the behavior:

  1. Build a test graph:
git init
touch a
git add -A
git commit -m 'a'
touch b
git add -A
git commit -m 'b'
git checkout HEAD~ -b c
touch c
git add -A
git commit -m 'c'
git checkout -
git merge --no-ff c
  1. Start gitui
  2. Switch to Log [2]
  3. Select commit with message 'c'
  4. Press space
  5. Select commit with message 'b'
  6. Press space
  7. Press y to yank commits
  8. On the result, run get rev-list '<copied text here>'
  9. git rev-list only outputs one commit

Expected behavior
git rev-list lists the two selected commits

Screenshots
Constructed history:

Image

Revlog with selection

Image

Yanked commit sequence and rev-list output

Image

Context (please complete the following information):

  • OS/Distro + Version: Linux 6.13.6
  • GitUI Version 0.27
  • Rust version: 1.85