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

Panic during an incomplete conflict resolution #2611

Closed
PhilipMetzger opened this issue Nov 21, 2023 · 3 comments
Closed

Panic during an incomplete conflict resolution #2611

PhilipMetzger opened this issue Nov 21, 2023 · 3 comments

Comments

@PhilipMetzger
Copy link
Collaborator

Description

This happened at $WORK, so this is a recollection. This happened while resolving another large conflict (8-sided if I remember correctly). It would be nice if we didn't panic during merge-tree creation, as it renders jj st and other commands useless.

Steps to Reproduce the Problem

  1. Create a conflicted file
  2. During conflict resolution, delete an unbalanced amount of diff markers
  3. Try to jj st to see if we have pending conflicts to solve.

Expected Behavior

jj log or jj st don't panic.

Actual Behavior

We hit an assertion in lib/src/merge.rs, which expects an even amount of adds and an odd amount of removes.

Specifications

  • Platform: Windows 11
  • Version: jj 0.11
@PhilipMetzger
Copy link
Collaborator Author

We've discussed this thoroughly in Discord and Martin recognized that this can happen when intermediate conflicts aren't resolved and any further command auto-squashes the still unfinished resolution.

We still shouldn't fail on an assertion but the immediate action to warn on incomplete resolutions should prevent anyone else hitting it.

@paulzzy
Copy link

paulzzy commented Sep 5, 2024

Does resolving all conflicts in the working copy fix the panic? I'm trying to figure out how to recover from this state.

EDIT: It does fix the panic!

@PhilipMetzger
Copy link
Collaborator Author

Also just balancing the conflicts to not hit the assertion also helps.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Oct 8, 2024
## [0.22.0] - 2024-10-02

### Breaking changes

* Fixing [#4239](jj-vcs/jj#4239) means the
  ordering of some messages have changed.

* Invalid `ui.graph.style` configuration is now an error.

* The builtin template `branch_list` has been renamed to `bookmark_list` as part
  of the `jj branch` deprecation.

### Deprecations

* `jj branch` has been deprecated in favor of `jj bookmark`.

  **Rationale:** Jujutsu's branches don't behave like Git branches, which a
  confused many newcomers, as they expected a similar behavior given the name.
  We've renamed them to "bookmarks" to match the actual behavior, as we think
  that describes them better, and they also behave similar to Mercurial's
  bookmarks.

* `jj obslog` is now called `jj evolution-log`/`jj evolog`. `jj obslog` remains
  as an alias.

* `jj unsquash` has been deprecated in favor of `jj squash` and
  `jj diffedit --restore-descendants`.

  **Rationale:** `jj squash` can be used in interactive mode to pull
  changes from one commit to another, including from a parent commit
  to a child commit. For fine-grained dependent diffs, such as when
  the parent and the child commits must successively modify the same
  location in a file, `jj diffedit --restore-descendants` can be used
  to set the parent commit to the desired content without altering the
  content of the child commit.

* The `git.push-branch-prefix` config has been deprecated in favor of
  `git.push-bookmark-prefix`.

* `conflict()` and `file()` revsets have been renamed to `conflicts()` and `files()`
  respectively. The old names are still around and will be removed in a future
  release.

### New features

* The new config option `snapshot.auto-track` lets you automatically track only
  the specified paths (all paths by default). Use the new `jj file track`
  command to manually tracks path that were not automatically tracked. There is
  no way to list untracked files yet. Use `git status` in a colocated workspace
  as a workaround.
  [#323](jj-vcs/jj#323)

* `jj fix` now allows fixing unchanged files with the `--include-unchanged-files` flag. This
  can be used to more easily introduce automatic formatting changes in a new
  commit separate from other changes.

* `jj workspace add` now accepts a `--sparse-patterns=<MODE>` option, which
  allows control of the sparse patterns for a newly created workspace: `copy`
  (inherit from parent; default), `full` (full working copy), or `empty` (the
  empty working copy).

* New command `jj workspace rename` that can rename the current workspace.

* `jj op log` gained an option to include operation diffs.

* `jj git clone` now accepts a `--remote <REMOTE NAME>` option, which
  allows to set a name for the remote instead of using the default
  `origin`.

* `jj op undo` now reports information on the operation that has been undone.

* `jj squash`: the `-k` flag can be used as a shorthand for `--keep-emptied`.

* CommitId / ChangeId template types now support `.normal_hex()`.

* `jj commit` and `jj describe` now accept `--author` option allowing to quickly change
  author of given commit.

* `jj diffedit`, `jj abandon`, and `jj restore` now accept a `--restore-descendants`
  flag. When used, descendants of the edited or deleted commits will keep their original
  content.

* `jj git fetch -b <remote-git-branch-name>` will now warn if the branch(es)
   can not be found in any of the specified/configured remotes.

* `jj split` now lets the user select all changes in interactive mode. This may be used
  to keeping all changes into the first commit while keeping the current commit
  description for the second commit (the newly created empty one).

* Author and committer names are now yellow by default.

### Fixed bugs

* Update working copy before reporting changes. This prevents errors during reporting
  from leaving the working copy in a stale state.

* Fixed panic when parsing invalid conflict markers of a particular form.
  ([#2611](jj-vcs/jj#2611))

* Editing a hidden commit now makes it visible.

* The `present()` revset now suppresses missing working copy error. For example,
  `present(@)` evaluates to `none()` if the current workspace has no
  working-copy commit.
tmeijn pushed a commit to tmeijn/dotfiles that referenced this issue Oct 18, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [martinvonz/jj](https://github.com/martinvonz/jj) | minor | `v0.21.0` -> `v0.22.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>martinvonz/jj (martinvonz/jj)</summary>

### [`v0.22.0`](https://github.com/martinvonz/jj/releases/tag/v0.22.0)

[Compare Source](jj-vcs/jj@v0.21.0...v0.22.0)

##### Breaking changes

-   Fixing [#&#8203;4239](jj-vcs/jj#4239) means the
    ordering of some messages have changed.

-   Invalid `ui.graph.style` configuration is now an error.

-   The builtin template `branch_list` has been renamed to `bookmark_list` as part
    of the `jj branch` deprecation.

##### Deprecations

-   `jj branch` has been deprecated in favor of `jj bookmark`.

    **Rationale:** Jujutsu's branches don't behave like Git branches, which a
    confused many newcomers, as they expected a similar behavior given the name.
    We've renamed them to "bookmarks" to match the actual behavior, as we think
    that describes them better, and they also behave similar to Mercurial's
    bookmarks.

-   `jj obslog` is now called `jj evolution-log`/`jj evolog`. `jj obslog` remains
    as an alias.

-   `jj unsquash` has been deprecated in favor of `jj squash` and
    `jj diffedit --restore-descendants`.

    **Rationale:** `jj squash` can be used in interactive mode to pull
    changes from one commit to another, including from a parent commit
    to a child commit. For fine-grained dependent diffs, such as when
    the parent and the child commits must successively modify the same
    location in a file, `jj diffedit --restore-descendants` can be used
    to set the parent commit to the desired content without altering the
    content of the child commit.

-   The `git.push-branch-prefix` config has been deprecated in favor of
    `git.push-bookmark-prefix`.

-   `conflict()` and `file()` revsets have been renamed to `conflicts()` and `files()`
    respectively. The old names are still around and will be removed in a future
    release.

##### New features

-   The new config option `snapshot.auto-track` lets you automatically track only
    the specified paths (all paths by default). Use the new `jj file track`
    command to manually tracks path that were not automatically tracked. There is
    no way to list untracked files yet. Use `git status` in a colocated workspace
    as a workaround.
    [#&#8203;323](jj-vcs/jj#323)

-   `jj fix` now allows fixing unchanged files with the `--include-unchanged-files` flag. This
    can be used to more easily introduce automatic formatting changes in a new
    commit separate from other changes.

-   `jj workspace add` now accepts a `--sparse-patterns=<MODE>` option, which
    allows control of the sparse patterns for a newly created workspace: `copy`
    (inherit from parent; default), `full` (full working copy), or `empty` (the
    empty working copy).

-   New command `jj workspace rename` that can rename the current workspace.

-   `jj op log` gained an option to include operation diffs.

-   `jj git clone` now accepts a `--remote <REMOTE NAME>` option, which
    allows to set a name for the remote instead of using the default
    `origin`.

-   `jj op undo` now reports information on the operation that has been undone.

-   `jj squash`: the `-k` flag can be used as a shorthand for `--keep-emptied`.

-   CommitId / ChangeId template types now support `.normal_hex()`.

-   `jj commit` and `jj describe` now accept `--author` option allowing to quickly change
    author of given commit.

-   `jj diffedit`, `jj abandon`, and `jj restore` now accept a `--restore-descendants`
    flag. When used, descendants of the edited or deleted commits will keep their original
    content.

-   `jj git fetch -b <remote-git-branch-name>` will now warn if the branch(es)
    can not be found in any of the specified/configured remotes.

-   `jj split` now lets the user select all changes in interactive mode. This may be used
    to keeping all changes into the first commit while keeping the current commit
    description for the second commit (the newly created empty one).

-   Author and committer names are now yellow by default.

##### Fixed bugs

-   Update working copy before reporting changes. This prevents errors during reporting
    from leaving the working copy in a stale state.

-   Fixed panic when parsing invalid conflict markers of a particular form.
    ([#&#8203;2611](jj-vcs/jj#2611))

-   Editing a hidden commit now makes it visible.

-   The `present()` revset now suppresses missing working copy error. For example,
    `present(@&#8203;)` evaluates to `none()` if the current workspace has no
    working-copy commit.

##### Contributors

Thanks to the people who made this release happen!

-   Austin Seipp ([@&#8203;thoughtpolice](https://github.com/thoughtpolice))
-   Danny Hooper ([@&#8203;hooper](https://github.com/hooper))
-   Emily Shaffer ([@&#8203;nasamuffin](https://github.com/nasamuffin))
-   Essien Ita Essien ([@&#8203;essiene](https://github.com/essiene))
-   Ethan Brierley ([@&#8203;eopb](https://github.com/eopb))
-   Ilya Grigoriev ([@&#8203;ilyagr](https://github.com/ilyagr))
-   Kevin Liao ([@&#8203;kevincliao](https://github.com/kevincliao))
-   Lukas Wirth ([@&#8203;Veykril](https://github.com/Veykril))
-   Martin von Zweigbergk ([@&#8203;martinvonz](https://github.com/martinvonz))
-   Mateusz Mikuła ([@&#8203;mati865](https://github.com/mati865))
-   mlcui ([@&#8203;mlcui-corp](https://github.com/mlcui-corp))
-   Philip Metzger ([@&#8203;PhilipMetzger](https://github.com/PhilipMetzger))
-   Samuel Tardieu ([@&#8203;samueltardieu](https://github.com/samueltardieu))
-   Stephen Jennings ([@&#8203;jennings](https://github.com/jennings))
-   Tyler Goffinet ([@&#8203;qubitz](https://github.com/qubitz))
-   Vamsi Avula ([@&#8203;avamsi](https://github.com/avamsi))
-   Yuya Nishihara ([@&#8203;yuja](https://github.com/yuja))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants