-
-
Notifications
You must be signed in to change notification settings - Fork 385
[WIP] Add commit signing #2208
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
base: main
Are you sure you want to change the base?
[WIP] Add commit signing #2208
Conversation
.extra_headers | ||
.push((BStr::new(SIGNATURE_FIELD_NAME), extra_header)); | ||
|
||
eprintln!("{commit_ref:?}"); |
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.
@Byron At this point, I would like to write the signed commit back to the filesystem. I searched the codebase for hints on how this is usually done, but couldn’t really find anything. Would you be able to point me to an example?
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.
That would be repo.write_object(&commit_ref)?
.
It's great you use the commit_ref
for this by the way as it means any commit, even somewhat malformed ones, can be signed with this.
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.
Thanks, that’s what I was looking for! I assume that, once the signed object has been written, rev_spec
needs to be made to point to the new commit, and the reflog needs to be updated. Is that what I’d use repo.edit_reference()
for?
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.
That's great to have!
Also, it's nice to see of gitoxide-core
is a test-bed, from where early implementations can graduate into gix::Repository
one day.
The biggest pat is probably reading the Git configuration to know which signing program to use.
.extra_headers | ||
.push((BStr::new(SIGNATURE_FIELD_NAME), extra_header)); | ||
|
||
eprintln!("{commit_ref:?}"); |
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.
That would be repo.write_object(&commit_ref)?
.
It's great you use the commit_ref
for this by the way as it means any commit, even somewhat malformed ones, can be signed with this.
This is a rough, incomplete prototype, mainly intended to allow me to ask a couple of questions on how to implement various things.