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

FR: preserve current Git branch in co-located repo when possible #2210

Closed
ilyagr opened this issue Sep 5, 2023 · 3 comments · Fixed by #2331
Closed

FR: preserve current Git branch in co-located repo when possible #2210

ilyagr opened this issue Sep 5, 2023 · 3 comments · Fixed by #2331
Assignees
Labels
colocated enhancement New feature or request good first issue Good for newcomers polish🪒🐃 Make existing features more convenient and more consistent

Comments

@ilyagr
Copy link
Collaborator

ilyagr commented Sep 5, 2023

This report stems from the discussion starting with #2183 (comment).

In a co-located repo, jj generally puts the git repo in a "detached HEAD" state since jj does not have a concept of the current branch. In general, I don't propose we change that.

However, after a git switch branch, we could make more effort to preserve branch as a current branch when possible.

jj already makes some effort here. For example touch qq && jj log keeps Git's current branch at branch. This is good.

However, jj describe -m qq currently switches to a detached HEAD state, even though it doesn't modify the @- commit where branch is at. This is undesired.

jj new @- also currently switches to a detached HEAD state. Arguably, it shouldn't for the same reason: if the user just did git switch branch, they probably mainly care about whether the @- commit (where branch is at) changed.

For reference, the situation git switch branch brings us to (after the subsequent automatic jj git import) is:

@ (empty) (no description set)
|
o branch
|
...
@necauqua
Copy link
Collaborator

necauqua commented Sep 6, 2023

As a bonus it will get rid of annoying warnings in tools 🙃
image
(at least sometimes)

@ilyagr ilyagr added good first issue Good for newcomers polish🪒🐃 Make existing features more convenient and more consistent labels Sep 6, 2023
@isinyaaa
Copy link
Collaborator

isinyaaa commented Sep 13, 2023

Hi, there, could this be assigned to me and @wmrmrx?

@wmrmrx
Copy link
Collaborator

wmrmrx commented Sep 13, 2023

Commenting so I can be assigned @wmrmrx

isinyaaa added a commit to isinyaaa/jj that referenced this issue Oct 4, 2023
yuja added a commit to yuja/jj that referenced this issue Oct 7, 2023
Otherwise, undone HEAD wouldn't be exported if we tried to preserve the
symbolic HEAD target (jj-vcs#2210). Unborn branch already has this problem.
yuja added a commit that referenced this issue Oct 7, 2023
Otherwise, undone HEAD wouldn't be exported if we tried to preserve the
symbolic HEAD target (#2210). Unborn branch already has this problem.
isinyaaa added a commit to isinyaaa/jj that referenced this issue Oct 29, 2023
isinyaaa added a commit to isinyaaa/jj that referenced this issue Oct 29, 2023
isinyaaa added a commit to isinyaaa/jj that referenced this issue Oct 30, 2023
isinyaaa added a commit to isinyaaa/jj that referenced this issue Oct 31, 2023
isinyaaa added a commit that referenced this issue Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
colocated enhancement New feature or request good first issue Good for newcomers polish🪒🐃 Make existing features more convenient and more consistent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants