Skip to content

FR: jj abandon should by default refuse to delete revisions pointed to by (tracked) bookmarks #6168

@YPares

Description

@YPares

Is your feature request related to a problem? Please describe.

When abandoning a revision or a whole revset, we may sometimes miss that we are also deleting the local tracked bookmarks pointing to them, which could lead to unwanted deletion from the remote the next time a jj git push --tracked is done.
It happened to me quite a few times that I would accidentally delete bookmarks after doing a rebase that resulted in divergent revisions. Sometimes I would notice before pushing, and sometimes not.
In general I think jj abandon is a bit too lenient.

Describe the solution you'd like

I would like jj abandon to fail when a revision to abandon is pointed to by a tracked bookmark.
Or even, more drastically, by any bookmark at all. I think that any bookmark deletion should always be explicit.

Two possibilities:

  • In the spirit of other flags (like jj bookmark move --allow-backwards or jj edit --ignore-immutable), jj abandon could provide a --delete-(tracked-)bookmarks flag that should be mandatory
  • simply require the user to first perform a jj bookmark forget or jj bookmark delete

Describe alternatives you've considered

Not using jj git push with --tracked, but mistakes happen. And in any case, it's better to make sure the bookmark deletion was really what the user wanted from the start, rather than mitigating the consequences later.

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