mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-27 07:46:13 +00:00
feat(daemon): prune branches merged without a PR, protect long-lived ones
- Prune a worktree whose pushed tip a merge commit brought into the default branch (not on its first-parent history), with no forge needed. - Never prune or keep from materializing main/master/development/... plus sync.prune_protected; this also stops a development->main PR pruning development. - Follow repos transferred or renamed on the forge when listing merged PRs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c7899bcdc0
commit
a1646bccb7
12 files changed
+323
-49
No files matched your search
@@ -158,6 +158,30 @@ pub trait Provider: Send + Sync {
|
||||
fn merged_pulls(&self, owner: &str, name: &str) -> Result<Vec<MergedPull>>;
|
||||
}
|
||||
|
||||
/// [`Provider::merged_pulls`] that also finds a repo transferred or renamed on the forge: `origin`
|
||||
/// may still name the old place, which git and the repo endpoint follow by redirect but the
|
||||
/// pulls endpoint does not. On failure the repo is looked up and, if its current owner/name
|
||||
/// differ, its pulls are listed under those.
|
||||
pub fn merged_pulls_following_moves(
|
||||
p: &dyn Provider,
|
||||
owner: &str,
|
||||
name: &str,
|
||||
) -> Result<Vec<MergedPull>> {
|
||||
let err = match p.merged_pulls(owner, name) {
|
||||
Ok(pulls) => return Ok(pulls),
|
||||
Err(e) => e,
|
||||
};
|
||||
match p.get_repo(owner, name) {
|
||||
Ok(r)
|
||||
if !r.owner.is_empty()
|
||||
&& !(r.owner.eq_ignore_ascii_case(owner) && r.name.eq_ignore_ascii_case(name)) =>
|
||||
{
|
||||
p.merged_pulls(&r.owner, &r.name)
|
||||
}
|
||||
_ => Err(err),
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds the provider described by `cfg`, using `token`.
|
||||
pub fn build(cfg: &ProviderCfg, token: String) -> Box<dyn Provider> {
|
||||
match cfg.kind {
|
||||
|
||||
Reference in new issue
Block a user