jj
jj copied to clipboard
`jj new` and `jj rebase` commit order does not produce
Description
Steps to Reproduce the Problem
- Given parents
aandb, create a merge commit by doingjj new a b -m "merge b into a". - Create a new commit (it can be empty!) and rebase it,
jj rebase -r c -d a -d b, providing the two destinations in the same order as given in thejj new(i.e. in step 1). - Note that the merge topology is inverted between the two.
Expected Behavior
The graph produced by passing changes in the same order to the new and rebase operations should be the same.
Actual Behavior
The resulting graphs have the inverse orders.
Working history to create the problem
$ jj git init --colocate
Initialized repo in "."
$ jj desc -m "base (don't want separate histories in Git)"
Working copy now at: q 5b8eccb1 (empty) base (don't want separate histories in Git)
Parent commit : z 00000000 (empty) (no description set)
$ jj new -m "a"
Working copy now at: s 30db9a96 (empty) a
Parent commit : q 5b8eccb1 (empty) base (don't want separate histories in Git)
$ jj new q -m "b"
Working copy now at: x 93a82b0e (empty) b
Parent commit : q 5b8eccb1 (empty) base (don't want separate histories in Git)
$ jj l
@ x [email protected] 2024-09-17 19:36:13 93a82b0e
│ (empty) b
│ ○ s [email protected] 2024-09-17 19:36:08 30db9a96
├─┘ (empty) a
○ q [email protected] 2024-09-17 19:35:56 HEAD@git 5b8eccb1
│ (empty) base (don't want separate histories in Git)
◆ z root() 00000000
$ jj new s x -m "merge s into x ('a' into 'b')"
Working copy now at: t 1d8c9d26 (empty) merge s into x ('a' into 'b')
Parent commit : s 30db9a96 (empty) a
Parent commit : x 93a82b0e (empty) b
$ jj l
@ t [email protected] 2024-09-17 19:36:38 1d8c9d26
├─┐ (empty) merge s into x ('a' into 'b')
│ ○ x [email protected] 2024-09-17 19:36:13 93a82b0e
│ │ (empty) b
○ │ s [email protected] 2024-09-17 19:36:08 HEAD@git 30db9a96
├─┘ (empty) a
○ q [email protected] 2024-09-17 19:35:56 5b8eccb1
│ (empty) base (don't want separate histories in Git)
◆ z root() 00000000
$ jj new q -m "c"
Working copy now at: m 7fd996e5 (empty) c
Parent commit : q 5b8eccb1 (empty) base (don't want separate histories in Git)
$ jj rebase -r m -d s -d x
Rebased 1 commits onto destination
Working copy now at: m 2e53189b (empty) c
Parent commit : s 30db9a96 (empty) a
Parent commit : x 93a82b0e (empty) b
$ jj desc -m "The commit once described as 'c' (now a merge)
This *should* have the same merge semantics as the `jj new` output"
Working copy now at: m f96adeaa (empty) The commit once described as 'c' (now a merge)
Parent commit : s 30db9a96 (empty) a
Parent commit : x 93a82b0e (empty) b
$ jj l
@ m [email protected] 2024-09-17 19:40:45 f96adeaa
├─┐ (empty) The commit once described as 'c' (now a merge)
│ │ ○ t [email protected] 2024-09-17 19:36:38 1d8c9d26
┌─┬─┘ (empty) merge s into x ('a' into 'b')
│ ○ x [email protected] 2024-09-17 19:36:13 93a82b0e
│ │ (empty) b
○ │ s [email protected] 2024-09-17 19:36:08 HEAD@git 30db9a96
├─┘ (empty) a
○ q [email protected] 2024-09-17 19:35:56 5b8eccb1
│ (empty) base (don't want separate histories in Git)
◆ z root() 00000000
$ jj bookmark create a -r s
Created 1 bookmarks pointing to s 30db9a96 a | (empty) a
$ jj bookmark create b -r x
Created 1 bookmarks pointing to x 93a82b0e b | (empty) b
$ jj bookmark create c -r m
Created 1 bookmarks pointing to m f96adeaa c | (empty) The commit once described as 'c' (now a merge)
$ jj new -m "just for the sake of Git"
Working copy now at: mz adbe5ab1 (empty) just for the sake of Git
Parent commit : mn f96adeaa c | (empty) The commit once described as 'c' (now a merge)
$ jj l
@ mz [email protected] 2024-09-17 19:42:01 adbe5ab1
│ (empty) just for the sake of Git
○ mn [email protected] 2024-09-17 19:40:45 c HEAD@git f96adeaa
├─┐ (empty) The commit once described as 'c' (now a merge)
│ │ ○ t [email protected] 2024-09-17 19:36:38 1d8c9d26
┌─┬─┘ (empty) merge s into x ('a' into 'b')
│ ○ x [email protected] 2024-09-17 19:36:13 b 93a82b0e
│ │ (empty) b
○ │ s [email protected] 2024-09-17 19:36:08 a 30db9a96
├─┘ (empty) a
○ q [email protected] 2024-09-17 19:35:56 5b8eccb1
│ (empty) base (don't want separate histories in Git)
◆ z root() 00000000
Specifications
- Platform: macOS Sonoma 14.6.1
- Version:
0.21.0-d9c68e08b1a575e63443cacb130806536de06e8a
The order of the rebased commit parents looks correct. Maybe it's a rendering issue of the tooling?
$ jj rebase -r m -d s -d x
Rebased 1 commits onto destination
Working copy now at: m 2e53189b (empty) c
Parent commit : s 30db9a96 (empty) a
Parent commit : x 93a82b0e (empty) b
You can use -Tparents.map(|c| c.commit_id()) to print parent commit ids in stored order.
@yuja Hmm, maybe. I have seen this cause issues with GitHub as well, but I will try to confirm further. It may be a case of PEBKAC. 🤔
Hello @chriskrycho did you have the opportunity to "confirm further" ?
I can't reproduce this. I think it's likely a rendering issue to avoid making the graph look more complicated.
FWIW I think it also improved with some of the recent work to make the graph output more stable. 👍🏼