lifecycle: add git_delete_ref
The deploy subtree parks its rollback state in a git ref and has to drop it again on both the success and the compensated path.
This commit is contained in:
parent
bdf15168db
commit
8899c9f355
2 changed files with 12 additions and 2 deletions
|
|
@ -167,3 +167,13 @@ pub async fn git_read_tree_reset(dir: &Path, target: &str) -> Result<()> {
|
|||
pub async fn git_update_ref(dir: &Path, refname: &str, target: &str) -> Result<()> {
|
||||
git(dir, &["update-ref", refname, target]).await
|
||||
}
|
||||
|
||||
/// Delete a ref. The counterpart to [`git_update_ref`] for the bookkeeping
|
||||
/// refs a deploy parks in the applied repo (`refs/hyperhive/rollback/<id>`,
|
||||
/// which records the pre-merge `main` so the deploy tail can compensate a
|
||||
/// merge that landed but never finalized). `update-ref -d` is a no-op-free
|
||||
/// delete: it errors if the ref does not exist, so callers that treat absence
|
||||
/// as "nothing to undo" should check with [`git_rev_parse`] first.
|
||||
pub async fn git_delete_ref(dir: &Path, refname: &str) -> Result<()> {
|
||||
git(dir, &["update-ref", "-d", refname]).await
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue