Skip to content

Commit

Permalink
Update create_git_tag endpoint to allow for tag hash
Browse files Browse the repository at this point in the history
Summary: `remote-gitimport` makes use of `scs` to record git tags at Mononoke end. This diff updates the parameter type for the `create_git_tag` endpoint to allow for specifying the hash of the git tag being created. It is optional since the callers will be updated later to provide the tag hash and meanwhile a none value will be used.

Differential Revision: D49805555

fbshipit-source-id: 25c295183cdfdd2259add84a79518a106f210e5b
  • Loading branch information
RajivTS authored and facebook-github-bot committed Oct 3, 2023
1 parent c15ec04 commit b14fd5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion eden/mononoke/scs/if/source_control.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -1654,10 +1654,12 @@ struct CreateGitTagParams {
4: optional binary pgp_signature;
/// The changeset corresponding to the commit that was pointed at by the tag.
5: binary target_changeset;
/// The identity of the service making the create git tree request.
/// The identity of the service making the create git tag request.
6: optional string service_identity;
/// The name of the tag for which the changeset is getting created
7: string tag_name;
/// The git SHA1 hash of the tag
8: optional binary tag_hash;
}

/// Method response structures
Expand Down
16 changes: 15 additions & 1 deletion eden/mononoke/scs_server/src/methods/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,23 @@ impl SourceControlServiceImpl {
target: BonsaiAnnotatedTagTarget::Changeset(target_changeset_id),
pgp_signature: params.pgp_signature.map(Bytes::from),
};
let tag_hash = params
.tag_hash
.as_ref()
.map(|hash| {
gix_hash::oid::try_from_bytes(hash)
.map(|oid| oid.to_owned())
.map_err(|err| {
invalid_request(format!(
"Error in creating Git ObjectId from {:?}. Cause: {:#}",
hash, err
))
})
})
.transpose()?;
let changeset_context = repo_ctx
.create_annotated_tag(
None, // To be populated later
tag_hash,
params.tag_name,
params.author,
author_date,
Expand Down

0 comments on commit b14fd5c

Please sign in to comment.