Update `SignedRefs::save` function

* Remove redundant `remote` parameter
* Fix commit message and remove redundant remote
This commit is contained in:
Alexis Sellier 2023-04-29 11:43:35 +02:00
parent 2ff6bf2fc4
commit 293a76948f
No known key found for this signature in database
2 changed files with 4 additions and 8 deletions

View File

@ -595,7 +595,7 @@ impl WriteRepository for Repository {
let refs = self.references_of(remote)?;
let signed = refs.signed(signer)?;
signed.save(remote, self)?;
signed.save(self)?;
Ok(signed)
}

View File

@ -281,13 +281,9 @@ impl SignedRefs<Verified> {
/// Save the signed refs to disk.
/// This creates a new commit on the signed refs branch, and updates the branch pointer.
pub fn save<S: WriteRepository>(
&self,
// TODO: This should be part of the signed refs.
remote: &RemoteId,
repo: &S,
) -> Result<Updated, Error> {
pub fn save<S: WriteRepository>(&self, repo: &S) -> Result<Updated, Error> {
let sigref = &SIGREFS_BRANCH;
let remote = &self.id;
let parent = match repo.reference(remote, sigref) {
Ok(r) => Some(r.peel_to_commit()?),
Err(git_ext::Error::Git(e)) if git_ext::is_not_found_err(&e) => None,
@ -323,7 +319,7 @@ impl SignedRefs<Verified> {
Some(&sigref),
&author,
&author,
&format!("Update signature for {remote}\n"),
"Update signed refs\n",
&tree,
&parent.iter().collect::<Vec<&git2::Commit>>(),
);