Skip to content

Conflicts on submodules have no clear resolution and give incorrect suggestion #7806

@AaronC81

Description

@AaronC81

Description

Suppose your commit graph looks like this:

○  xtwxpvmm [email protected] 2025-10-21 18:58:29 git_head() 3423f0ce
│  Switch to bar branch
│ ○  pzqlukpm [email protected] 2025-10-21 18:57:44 f3914425
├─╯  Switch to foo branch
○  nqzpqpsx [email protected] 2025-10-21 18:54:15 51c47fbc
│  Initial submodule version
○  xwmtkknk [email protected] 2025-10-21 18:49:29 1da518ab
│  Add submodule

Where xt and pz switch the same submodule to a different commit.

Running jj new xt pz to create a merge commit causes a conflict on the submodule - which is fair enough:

$ jj new xt pz
Working copy  (@) now at: wqnyzqkp ac85a8d0 (conflict) (empty) (no description set)
Parent commit (@-)      : xtwxpvmm 3423f0ce Switch to bar branch
Parent commit (@-)      : pzqlukpm f3914425 Switch to foo branch
Added 0 files, modified 1 files, removed 0 files
Warning: 1 of those updates were skipped because there were conflicting changes in the working copy.
Hint: Inspect the changes compared to the intended target with `jj diff --from ac85a8d0e541`.
Discard the conflicting changes with `jj restore --from ac85a8d0e541`.
Warning: There are unresolved conflicts at these paths:
submodule    2-sided conflict including a git submodule

The issue is that I haven't figured out how to recover from this conflict.

The suggestion of jj restore --from ac85a8d0e541 just changes the commit ID of the working copy, and then gives the same suggestion again, getting you into a infinite loop of suggestions:

$ jj restore --from ac85a8d0e541
Working copy  (@) now at: wqnyzqkp 935868f1 (conflict) (empty) (no description set)
Parent commit (@-)      : xtwxpvmm 3423f0ce Switch to bar branch
Parent commit (@-)      : pzqlukpm f3914425 Switch to foo branch
Added 1 files, modified 0 files, removed 0 files
Warning: 1 of those updates were skipped because there were conflicting changes in the working copy.
Hint: Inspect the changes compared to the intended target with `jj diff --from 935868f13ae3`.
Discard the conflicting changes with `jj restore --from 935868f13ae3`.
Warning: There are unresolved conflicts at these paths:
submodule    2-sided conflict including a git submodule

jj st says the submodule has been deleted:

$ jj st                         
Working copy changes:
D submodule
Working copy  (@) : wqnyzqkp 37f41505 (no description set)
Parent commit (@-): xtwxpvmm 3423f0ce Switch to bar branch
Parent commit (@-): pzqlukpm f3914425 Switch to foo branch

I haven't been able to figure out how to get Jujutsu out of this state, and start working on my repo as normal again.

Steps to Reproduce the Problem

I've created a repo with a couple of branches as an easy submodule, but there's nothing specific about the setup of this repo which causes the problem.

Pushing a repo created by following these steps to GitHub, then checking it out with jj git clone, interestingly did not appear to reproduce the exact same issue. I still got a conflict, but didn't get the jj restore --from ... suggestion.

# Create initial repo setup
git init
git submodule add -f https://github.com/AaronC81/2025-10-21-submodule-test.git submodule
git add submodule .gitmodules
git commit -m "Initial commit"

# Create foo branch
git checkout -b foo-branch
cd submodule
git fetch origin foo-branch
git switch foo-branch
cd ..
git add submodule
git commit -m "Switch to foo branch"

# Create bar branch
git switch main
git checkout -b bar-branch
cd submodule
git fetch origin bar-branch
git switch bar-branch
cd ..
git add submodule
git commit -m "Switch to bar branch"

# Use jj to merge
jj git init
jj log      # Check change IDs of "switch to foo/bar" branch commits
jj new m n  # Replacing with your change IDs

Expected Behavior

Jujutsu encounters a conflict on the submodules, and gives me a way to resolve it, possibly with a suggestion which guides me towards this resolution.

Actual Behavior

Jujutsu encounters a conflict, but there is no clear way to resolve it, and the provided suggestion doesn't work.

Specifications

  • Platform: Windows 11, macOS Sequoia
  • Version: 0.33.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions