-
Notifications
You must be signed in to change notification settings - Fork 319
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
cli: say "(forgotten)" if branch is listed just because it's in git_refs #1739
Conversation
It only applies to local branches, and None doesn't always mean deleted as we have pseudo "git" remote.
I thought we would need additional bookkeeping to detect forgotten branches, but I was wrong. If a branch exists only in git_refs, it is forgotten (but not yet exported.)
Inspired by d01ecc5 "more detailed message describing deleted branches." And yes, "jj git export" does propagate "jj branch forget" to the underlying Git repository, which strengthen my feeling that git::export_refs() should also remove "forgotten" remote tracking refs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Re commit message.
It does. I did say otherwise once, I hope I corrected myself but I'm unsure.
I hope to have a more educated opinion on this soon. I might even add this functionality to #1700 to fix a bug. The other option that a priori (i.e. in my uneducated opinion) also seems reasonable to me would be to have |
If we have (In principle, we could restrict it to I went through one example: undo of push from Martin's #1541. I think that if we also do what I said in the previous paragraph, such a change would get rid of the conflict in that test. This is likely a good thing. I haven't yet thought through what other good (or bad) consequences this change might have, but the one example gave me the sense that this export seems make I don't like my idea of only importing/exporting these refs on |
Also, the fact that I previously thought this is OK because I thought that I'll try writing some versions of Martin's test that demo this. (Update: done, see the second commit of #1700). |
Another thing to worry about is whether this is safe while These things should be solvable, but it might take time and effort. |
Yes, that's also my concern. Another way around is to not import nor export
(FWIW, I use
If that means jj's remote-tracking branches should be always kept in sync with backed git repo, can't we blindly trust jj's remote branch targets? |
I think this would mean that, in a colocated repo, using git for a Update: I'm unsure, but perhaps adding some sort of post-fetch & pre-push git hook could help here. I bet not all git clients execute those hooks, though. |
Yes. We'll need to run
Good point about |
I don't think it can. I used to think otherwise, back when I also thought that we might be able to stop tracking git repo's remote-tracking branches in jj's git-tracking refs, but I think we have to keep track of them. One alternative that seems pretty clean to me would be to have If you use BTW, I think it's quite important to support people using git's |
I see. As the one who actually use I think the problem of the current model is that the last-known |
Exactly, that's what I was thinking in #1666 (comment). |
The original test is copied from @martinvonz 's [PR draft] (thanks!). The three versions show differences in behavior due to import/export of remote-tracking branches, and due to repo being colocated. The former is relevant for [the discussion] of whether `jj git export` should export remote-tracking branches. The latter will change in a follow-up commit. Outstanding TODO: check if we have similar tests for undoing `fetch` [PR draft]: #1541 [the discussion]: #1739
@ilyagr, can you take a look?
Checklist
If applicable:
CHANGELOG.md