Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebase -r: preserve skipped ancestor edges #4663

Open
bnjmnt4n opened this issue Oct 17, 2024 · 0 comments
Open

rebase -r: preserve skipped ancestor edges #4663

bnjmnt4n opened this issue Oct 17, 2024 · 0 comments
Labels
polish🪒🐃 Make existing features more convenient and more consistent

Comments

@bnjmnt4n
Copy link
Collaborator

bnjmnt4n commented Oct 17, 2024

Just commenting why I think the f->e->b edge should be preserved:

  1. disconnected -r targets are rebased as if they were all connected
  2. in order to achieve that, internal edges across skipped nodes are preserved
  3. so it seems better to apply the same rule to external edges

In practice, I wouldn't try this kind of weird rebase, and I wouldn't mind if f->e->b was removed. My point is that it's easier to reason about the behavior if we have a consistent model (such as rebase -r c|f is equivalent to rebase --keep -r c::f + abandon c|f + abandon e'.)

    create_commit(&test_env, &repo_path, "a", &[]);
    create_commit(&test_env, &repo_path, "b", &["a"]);
    create_commit(&test_env, &repo_path, "c", &["a"]);
    create_commit(&test_env, &repo_path, "d", &["a"]);
    create_commit(&test_env, &repo_path, "e", &["c", "b"]);
    create_commit(&test_env, &repo_path, "f", &["e"]);
    insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
    @  f
    ◉    e
    ├─╮
    │ ◉  b
    ◉ │  c
    ├─╯
    │ ◉  d
    ├─╯
    ◉  a
    ◉
    "###);

    // TODO: edge f->e->b is lost
    test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "c|f", "-d", "d"]);
    insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###"
    @  f
    ◉  c
    ◉  d
    │ ◉  e
    ╭─┤
    │ ◉  b
    ├─╯
    ◉  a
    ◉
    "###);

Originally posted by @yuja in #3605 (comment)

@PhilipMetzger PhilipMetzger added the polish🪒🐃 Make existing features more convenient and more consistent label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polish🪒🐃 Make existing features more convenient and more consistent
Projects
None yet
Development

No branches or pull requests

2 participants