-
Notifications
You must be signed in to change notification settings - Fork 390
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
Warn/require confirmation on bookmarking empty changes? #5374
Comments
I am working on fixing this issue. |
That sounds good to me. There are two practical things to consider:
Do we want to introduce a new jj config knob(s), say:
That way users (or tests) can set those knows to true to continue working as they do today. I don't have a strong preference, and don't mind fixing every test if necessary. |
Good question. We can ask on Discord how people feel about it. I basically never create bookmarks (outside of tests and demos). |
Regardless of what we do with the default, I'm against adding configuration for this. It seems like too much UI complexity for minimal gain. Also regardless of the default, shouldn't we just warn whenever you try to set a bookmark to an empty, single-parent revision?
Philosophically, I think we should remove the default, as it seems to derive from the working-copy-oriented branching style, in order to keep commits reachable/visible. If users prefer to bookmark |
I think it's fine to set a bookmark to such commits, kind of like how it's okay to set a description before you write code. By making the revision argument required, we're just making the user think about the target, without saying that it's a bad thing to target an empty commit. But that's just my opinion. Note that I barely use bookmarks myself. The discussion on Discord seemed a bit inconclusive. It seemed like some users like the current default. Some users would prefer if it was |
I think it's a bit of a trap for new users onboarding to the jj model, especially because putting the bookmark back on @- takes a somewhat long command. Requiring an explicit destination seems coherent with jj requiring explicit instructions for some other cases. But that's just my impression as a new user. |
I agree that making target revision explicit is a good change. Specifically, I agree with martinvonz that we should allow setting a boomark on an empty commit, but we can revisit that decision. I view that as separate from this open issue. |
+1 for being consistent, i.e. having the commands require explicitly specifying a revision. As for new users, the warning about moving bookmarks backwards does not make the experience any better, so avoiding that seems like a good idea. And I think users that are accustomed to the current behaviour are able to work around that with e.g. an alias as recommended above. |
As I said above, the conclusion from Discord was unclear. But the recent messages here all seem to be for making the revision argument required :) @jennings, I think you were one of the users on Discord who said you kind of like the current behavior. I know you said you don't feel very strongly at all, so I'm not calling you here to defend your position (but feel free to) :) I Just wanted to make sure it won't be a surprise, given the Discord discussion, if we decide to make the revision argument required. I'm fine with making the revision argument required.
I'm for being consistent, but I'm not convinced that requiring an explicit revision argument is consistent. Lots of commands currently default to
I think that's a separate issue. I would like to hear from more users before we make a decision about that. Feel free to open a separate issue for removing that flag (I think you're talking about |
You misunderstood me, sorry. I was merely adding to @sourcefrog 's point that the command to move a bookmark backwards is long. Most newcomers will try to do that and then get that "scary" warning about having to use the As for the discussion on whether or not bookmark commands would need an explicit revision or not: Maybe the better way out for now is to address the topic of setting bookmarks to empty changes as described in the OP. Maybe introducing a configuration option to have jj allow or not allow setting a bookmark to an empty change (or have jj warn or not warn) would be an easy way out? |
In case people don't know, The reason it's not there is that it's a bit difficult to insert both options without making the message more confusing, but hopefully we'll think of something. (I think we have to include the long version since it explains what the option does) Perhaps "Use --allow-backwards (alias -B) to allow it." |
I don't think there should be a limit on which revision can be bookmarked. I think you can't get rid of the Git expectations since there is a Git interface, but there should be less friction when using it. |
I usually edit commits directly instead of Even though it's ever so slightly inconvenient for my use, it sounds like requiring
Yes, but I think aliases for sub-commands are a little inconvenient because I have to backtrack my thoughts. This is my thought process step-by-step: # Time to set a bookmark!
$ jj _
# Bookmark commands are nested under the "bookmark" namespace
$ jj bookmark _
# Oh crap, I have an alias for this
^H^H^H^H^H^H^H^H
$ jj bset my-branch <ENTER> If I could create an alias nested under the "bookmark" command, then I'd have no issue with it :) |
How would this interact with |
Now you will have to do this:
In short, you will have to specify the target revision in:
From a feature point of view the only change here is making target revision required, otherwise things work exactly as before. |
Discussed in #5363
Originally posted by sourcefrog January 14, 2025
In getting to know jj, when I am working on a feature branch that I want to push to github, I've fairly often run a flow like
The trap of course is that the bookmark is set to the new empty revision following the thing that I committed. I suppose pushing the empty rev to a feature branch on github is not too harmful but it does seem a bit messy.
The right answer I guess is that I should either
bookmark move -r@-
jj desc
then bookmark it but then don't forget tojj new
I see there is a good bit of existing discussion about various types of auto-moving bookmarks, which would perhaps be a more fundamental answer for this kind of workflow:
--advance-branches
flag forjj commit
#2338As a more concrete and tactical (perhaps excessively tactical) fix I wonder if the UI should by default prevent moving a bookmark to an empty change, the same way it by default prevents you pushing new bookmarks and moving bookmarks backwards.
That is,
jj new; jj bookmark set bbb
would fail unless you said--allow-empty
.Alternatively, rather than failing it could say
The text was updated successfully, but these errors were encountered: