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: Transfer change ids via Git remote #4706

Open
sheremetyev opened this issue Oct 24, 2024 · 6 comments
Open

FR: Transfer change ids via Git remote #4706

sheremetyev opened this issue Oct 24, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@sheremetyev
Copy link
Contributor

Is your feature request related to a problem? Please describe.
At the moment separate clones of the same Git repository (e.g. on different machines) may have different "change id" for the same commit. Lack of (reliable) stable identifier for commits across clones makes it hard to refer to them.

Describe the solution you'd like
When commit is first pushed to a git remote, its change id should be stored on the remote. When commit is first pulled into another clone, change id should be read from remote as well and used. For commits initially pushed with vanilla Git something reasonable should be done :)

Describe alternatives you've considered
Refer to commits using hashes - works only if commit content hasn't changed.

Additional context
N/A

@PhilipMetzger PhilipMetzger added the enhancement New feature or request label Oct 24, 2024
@joyously
Copy link

If the algorithm for computing the change ID results in the same ID from the commit regardless of remote or local, there is no reason to store jj data in a Git remote.

@martinvonz
Copy link
Member

The change id is initially generated in a deterministic way but then it follows the commit as it's rewritten, so later versions of the change will not have a change id that can be determined from the commit id.

@edwintorok
Copy link

Could 'git notes' be used to store 'change ids'?

@martinvonz
Copy link
Member

They were unil commit c260fea

@edwintorok
Copy link

Perhaps the conversion from the current storage format to git notes could be done lazily on git push/fetch?

@arxanas
Copy link
Contributor

arxanas commented Nov 11, 2024

[long-term] One approach is to somehow synchronize the operation log instead of change IDs directly.

  • You could imagine a special branch/ref that jj could push/pull as part of some command, which represents the operation log data.
    • In the Git model, it's possible to design special "op-log commits" such that when they're pulled, they also pull the referenced commits, via an abuse of the parentage mechanism.
    • This would be an important design point because Git doesn't necessarily allow you to fetch arbitrary objects by hash, unless they're reachable by some ref, or some server config option is set (I forget what). It's also relevant for garbage collection purposes.
  • This would also help in the "distributed rewrites" case, where one person rewrites commits that another person is building on in a way that wouldn't be handled by just synchronizing change IDs.
    • Or it can be the same person but in different repos, like the original request.

However, it doesn't seem realistic in the near-term due to a significant amount of design and implementation work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants