Update `SignedRefs::save` function
* Remove redundant `remote` parameter * Fix commit message and remove redundant remote
This commit is contained in:
parent
2ff6bf2fc4
commit
293a76948f
|
|
@ -595,7 +595,7 @@ impl WriteRepository for Repository {
|
||||||
let refs = self.references_of(remote)?;
|
let refs = self.references_of(remote)?;
|
||||||
let signed = refs.signed(signer)?;
|
let signed = refs.signed(signer)?;
|
||||||
|
|
||||||
signed.save(remote, self)?;
|
signed.save(self)?;
|
||||||
|
|
||||||
Ok(signed)
|
Ok(signed)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -281,13 +281,9 @@ impl SignedRefs<Verified> {
|
||||||
|
|
||||||
/// Save the signed refs to disk.
|
/// Save the signed refs to disk.
|
||||||
/// This creates a new commit on the signed refs branch, and updates the branch pointer.
|
/// This creates a new commit on the signed refs branch, and updates the branch pointer.
|
||||||
pub fn save<S: WriteRepository>(
|
pub fn save<S: WriteRepository>(&self, repo: &S) -> Result<Updated, Error> {
|
||||||
&self,
|
|
||||||
// TODO: This should be part of the signed refs.
|
|
||||||
remote: &RemoteId,
|
|
||||||
repo: &S,
|
|
||||||
) -> Result<Updated, Error> {
|
|
||||||
let sigref = &SIGREFS_BRANCH;
|
let sigref = &SIGREFS_BRANCH;
|
||||||
|
let remote = &self.id;
|
||||||
let parent = match repo.reference(remote, sigref) {
|
let parent = match repo.reference(remote, sigref) {
|
||||||
Ok(r) => Some(r.peel_to_commit()?),
|
Ok(r) => Some(r.peel_to_commit()?),
|
||||||
Err(git_ext::Error::Git(e)) if git_ext::is_not_found_err(&e) => None,
|
Err(git_ext::Error::Git(e)) if git_ext::is_not_found_err(&e) => None,
|
||||||
|
|
@ -323,7 +319,7 @@ impl SignedRefs<Verified> {
|
||||||
Some(&sigref),
|
Some(&sigref),
|
||||||
&author,
|
&author,
|
||||||
&author,
|
&author,
|
||||||
&format!("Update signature for {remote}\n"),
|
"Update signed refs\n",
|
||||||
&tree,
|
&tree,
|
||||||
&parent.iter().collect::<Vec<&git2::Commit>>(),
|
&parent.iter().collect::<Vec<&git2::Commit>>(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue