Discussion seed: Using ChangeIds as identifiers in the CLI #11801
Caleb-T-Owens
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
Some other possible points for discussion:
I don't know if a user would want to lookup an upstream commit by change ID (say, they saw it on Gerrit and want to check it out locally), but if they do, it won't work with the current proposal. (I can't think of any good solutions.) Otherwise what you suggest looks good, including falling back to the commit ID if there's a conflict with the change ID. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Byron and I landed reverse hex change ids in #11788, and I just wanted to open pandora's box and start the conversation around using them as identifiers in the CLI.
This is really just a bit of a brain-dump of some thoughts I had. I'd love to discuss this more.
ChangeIds in GitButler
GitButler now reads and writes the
change-idheader. It's generally been agreed between JJ, GB, Gerrit, and co that it should be a 32 character "reverse-hex" value.With that said, a user or another tool could put whatever arbitrary data they want in there.
To GitButler, the
change-id's value is completely transparent. When cherry-picking, we take any contents of the old identifier and will write it verbatim into the commit we are writing. This is hopefully the most compatible way of working with other tools.Things to consider when using ChangeIds as identifiers
Within a workspace there is no guarantee of change-id uniqueness. If a user cherry picked a commit twice into the same branch, you would have two commits with the same change id.
We also from an aesthetic standpoint I think always want to display change ids as reverse hex.
A starting point for finding identifiers for the CLI.
I've probably not found all the cases, but a starting point for an algorithm might be as follows:
sha-1ing the value & converting to reverse hexThe reason I suggest we use the oid of both commits in the case of a conflict is because I'm not sure there would be a stable way of picking which commit should use the change ID, and could potentially cause more confusion.
Beta Was this translation helpful? Give feedback.
All reactions