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: Allow users to see and address git repo refs as @git branches #1666

Closed
3 of 4 tasks
ilyagr opened this issue Jun 5, 2023 · 3 comments
Closed
3 of 4 tasks

FR: Allow users to see and address git repo refs as @git branches #1666

ilyagr opened this issue Jun 5, 2023 · 3 comments
Labels
colocated enhancement New feature or request

Comments

@ilyagr
Copy link
Contributor

ilyagr commented Jun 5, 2023

This will present the refs tracking the local git repo branches similarly to remote-tracking branches. This would affect:

  • Revision parser
  • jj log via the branches() function in the templater
  • jj branch list output
  • We should figure out what to do with the jj refs tracking the local git repo's remote-tracking branches. E.g., we could refer to them as @remote@git. I was previously hoping to remove them entirely, but I now think they are necessary (see comment below).

(might add more to the list above once I think of it)

The @git branch should only be shown if it differs from the local branch. The user should see this rarely. Especially in a colocated repository, if @git ref does not match the local branch, something weird is going on. For example, the local branch might be conflicted or missing.

I'm not necessarily proposing changing the way git_refs are stored in the view option. From the perspective of git_refs, we would only display the local git branches; this is similar how we currently display tags and have the revision parser understand tags.

There will still be some important user-visible differences in the way the git "remote" is treated compared to normal remotes.

jj branch forget should not remove the git remote ref.

This would be easily observed by users, and should be documented.

In spite of the potential confusion, I think this is the best option we have. Otherwise, we'd have two choices I can think of:

  • Delete the git branch and git remote-tracking branch on jj branch forget. This would be
    the only case jj does something like that outside jj git export. We'd also have to decide
    how jj op restore can work when restoring past such an operation.

    Also, it's important to note that, currently (with git remote refs preserved), jj branch forget && jj git export has exactly this effect without having to do anything exceptional.

  • Not touch them as normal. This would mean that the local branch to be immediately recreated on the next jj git import if either the local branch or a remote-tracking branch for it exists in the git repo.

    The user would have a hard time getting rid of the branch. If they delete it on the git side, it would be recreated by the next jj git export.

jj undo will treat it differently, at least in colocated repositories

See #922 and the discussion in #1541

(might add more to this list once I think of it)

Update: I previously mentined a bug report by @arxanas here, but it's not relevant. See #1714 for that.

@ilyagr ilyagr added enhancement New feature or request colocated labels Jun 5, 2023
@ilyagr ilyagr self-assigned this Jun 11, 2023
@ilyagr
Copy link
Contributor Author

ilyagr commented Jun 12, 2023

Update: actually, this plan will not resolve @arxanas's issue. For that to be address, we'd probably need to address accessing remote-tracking branches in the local git repo, which is a step beyond this issue.

ilyagr added a commit that referenced this issue Jun 12, 2023
This doesn't change the way @git branches are stored in `git_refs` as opposed
to inside `BranchTarget` like normal remote-tracking branches. There are
subtle differences in behavior with e.g. `jj branch forget` and I'm not sure
how easy it is to rewrite `jj git import/export` to support a different
way of storage.

I've decided to call these "local-git tracking branches" since they track
branches in the local git repository. "local git-tracking" branches sounds a
bit more natural, but these could be confused with there are no remote
git-tracking branches. If one had the idea these might exist, they would be
confused with remote-tracking branches in the local git repo.

This addresses a portion of #1666
@ilyagr ilyagr removed their assignment Jun 13, 2023
@ilyagr ilyagr changed the title FR: Allow users to see and address local git repo refs as @git branches FR: Allow users to see and address git repo refs as @git branches Jun 19, 2023
@ilyagr
Copy link
Contributor Author

ilyagr commented Jun 19, 2023

I added the question of what to do with refs tracking the local git repo's remote-tracking branches. E.g., we could refer to them as @remote@git.

I was previously hoping to remove them entirely, but I now think they are necessary in colocated repos. We need them for the same reason as the refs tracking the local git branches: we to differentiate between A) the situation when jj git fetch happened and the remote-tracking branches on the jj are more up to date and B) the situation when git fetch happened and the remote-tracking branches on the git side are more up to date.

ilyagr added a commit to ilyagr/jj that referenced this issue Jun 29, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jun 30, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jun 30, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jun 30, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jun 30, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jun 30, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jun 30, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jun 30, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jul 1, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jul 1, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit to ilyagr/jj that referenced this issue Jul 1, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
jj-vcs#1666 (comment)

More refactoring will likely happen when that bug is fixed.
ilyagr added a commit that referenced this issue Jul 3, 2023
I now believe that jj will need to store git-tracking refs for both local and
remote-tracking branches of the git repo for the long term. See
#1666 (comment)

More refactoring will likely happen when that bug is fixed.
yuja added a commit to yuja/jj that referenced this issue Jul 8, 2023
@yuja
Copy link
Contributor

yuja commented Oct 17, 2023

  • We should figure out what to do with the jj refs tracking the local git repo's remote-tracking branches. E.g., we could refer to them as @remote@git.

I think this one is settled, so closing the issue.

We couldn't remove git_refs, but users no longer need to care about that.
https://github.com/martinvonz/jj/blob/390b3208da4bf95526fc491b2db06a127c5a3caa/docs/design/tracking-branches.md#importexport-data-flow

@yuja yuja closed this as completed Oct 17, 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
Projects
None yet
Development

No branches or pull requests

2 participants