Skip to content

jj leaves stale commit IDs in conflict markers #10030

Description

@Christoph-D

Description

jj doesn't update commit IDs in conflict markers in the working copy when rewriting a change with conflicts.

Steps to Reproduce the Problem

$ cat repro.sh
#!/bin/bash

set -e

jj git init test-repo
cd test-repo

jj commit -m 'initial commit'
echo 'content: A' > file.txt
jj commit -m 'write A'
jj new '@--'
echo 'content: B' > file.txt
jj commit -m 'write B'

echo -e '\n*** Create conflict'

jj new zzzzzzzz++

echo -e '\n*** File content:'
cat file.txt

echo -e '\n*** Log:'
jj log

echo -e '\n*** Abandon base change'
jj abandon zzzzzzzz+

echo -e '\n*** File content:'
cat file.txt

echo -e '\n*** Log:'
jj log

Then:

$ chmod +x repro.sh && ./repro.sh 
Initialized repo in "test-repo"
Working copy  (@) now at: lqznsxxp c0fd4859 (empty) (no description set)
Parent commit (@-)      : spkoylnt 2d18f72c (empty) initial commit
Working copy  (@) now at: kzuuukyz d25c2f0d (empty) (no description set)
Parent commit (@-)      : lqznsxxp d87f2449 write A
Working copy  (@) now at: lprtmmuz 7c94ecd7 (empty) (no description set)
Parent commit (@-)      : spkoylnt 2d18f72c (empty) initial commit
Added 0 files, modified 0 files, removed 1 files
Working copy  (@) now at: swspvyoz 5ccc567f (empty) (no description set)
Parent commit (@-)      : lprtmmuz 122d05bd write B

*** Create conflict
Working copy  (@) now at: xlmmplyl 2f8f66e3 (conflict) (empty) (no description set)
Parent commit (@-)      : lprtmmuz 122d05bd write B
Parent commit (@-)      : lqznsxxp d87f2449 write A
Added 0 files, modified 1 files, removed 0 files
Warning: There are unresolved conflicts at these paths:
file.txt    2-sided conflict

*** File content:
<<<<<<< conflict 1 of 1
%%%%%%% diff from: spkoylnt 2d18f72c "initial commit"
\\\\\\\        to: lprtmmuz 122d05bd "write B"
+content: B
+++++++ lqznsxxp d87f2449 "write A"
content: A
>>>>>>> conflict 1 of 1 ends

*** Log:
@    xlmmplyl code@example.com 2026-08-21 23:01:29 2f8f66e3 (conflict)
├─╮  (empty) (no description set)
│ ○  lqznsxxp code@example.com 2026-08-21 23:01:29 d87f2449
│ │  write A
○ │  lprtmmuz code@example.com 2026-08-21 23:01:29 122d05bd
├─╯  write B
○  spkoylnt code@example.com 2026-08-21 23:01:29 2d18f72c
│  (empty) initial commit
◆  zzzzzzzz root() 00000000

*** Abandon base change
Abandoned 1 commits:
  spkoylnt 2d18f72c (empty) initial commit
Rebased 3 descendant commits onto parents of abandoned commits.
Working copy  (@) now at: xlmmplyl 164d3bd4 (conflict) (empty) (no description set)
Parent commit (@-)      : lprtmmuz bc44bec2 write B
Parent commit (@-)      : lqznsxxp a0cea1e4 write A
Warning: There are unresolved conflicts at these paths:
file.txt    2-sided conflict

*** File content:
<<<<<<< conflict 1 of 1
%%%%%%% diff from: spkoylnt 2d18f72c "initial commit"
\\\\\\\        to: lprtmmuz 122d05bd "write B"
+content: B
+++++++ lqznsxxp d87f2449 "write A"
content: A
>>>>>>> conflict 1 of 1 ends

*** Log:
@    xlmmplyl code@example.com 2026-08-21 23:01:29 164d3bd4 (conflict)
├─╮  (empty) (no description set)
│ ○  lqznsxxp code@example.com 2026-08-21 23:01:29 a0cea1e4
│ │  write A
○ │  lprtmmuz code@example.com 2026-08-21 23:01:29 bc44bec2
├─╯  write B
◆  zzzzzzzz root() 00000000

Expected Behavior

jj should update the conflict markers to point to the rewritten commit IDs.

Actual Behavior

The conflict markers in the working copy still refer to the old superseded commit IDs.

For example

+++++++ lqznsxxp d87f2449 "write A"`

should be

+++++++ lqznsxxp a0cea1e4 "write A"`

to match the commit ID of the rewritten change.

Specifications

  • Platform: Ubuntu 26.04
  • Version: 0.44

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions