mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 23:36:11 +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
@@ -9,7 +9,7 @@ use crate::merged::{MergedCache, has_candidates};
|
||||
use crate::purge;
|
||||
use crate::visibility::{RealForge, Visibility, snapshot_gate};
|
||||
use grove_core::config::Config;
|
||||
use grove_core::prune::Pruned;
|
||||
use grove_core::prune::{Pruned, merged_how};
|
||||
use grove_core::receive::Received;
|
||||
use grove_core::sync::{Options, sync_repo};
|
||||
use notify::{EventKind, RecursiveMode, Watcher};
|
||||
@@ -632,6 +632,8 @@ fn pass(
|
||||
push_snapshots,
|
||||
merged: merged_heads,
|
||||
disposable: cfg.sync.prune_disposable.clone(),
|
||||
prune: cfg.sync.prune_merged,
|
||||
protected: cfg.sync.protected_branches(),
|
||||
};
|
||||
let result = sync_repo(repo, &opts);
|
||||
if !offline && purge_if_gone(repo, cfg, st, &result, gone_since, ctx) {
|
||||
@@ -713,12 +715,13 @@ fn pass(
|
||||
"pruned_merged",
|
||||
Some(&name),
|
||||
format!(
|
||||
"{branch}: merged in PR #{pr}; removed {} (tip kept in {backup_ref})",
|
||||
"{branch}: {}; removed {} (tip kept in {backup_ref})",
|
||||
merged_how(*pr),
|
||||
path.display()
|
||||
),
|
||||
),
|
||||
Pruned::Kept { branch, pr, why } => {
|
||||
kept.push(format!("{branch}: merged in PR #{pr} but kept: {why}"))
|
||||
kept.push(format!("{branch}: {} but kept: {why}", merged_how(*pr)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ impl PullSource for RealForge {
|
||||
name: &str,
|
||||
) -> Result<Vec<MergedHead>, String> {
|
||||
let (token, _) = grove_providers::token::resolve(id, pc).map_err(|e| e.to_string())?;
|
||||
let pulls = grove_providers::build(pc, token)
|
||||
.merged_pulls(owner, name)
|
||||
let forge = grove_providers::build(pc, token);
|
||||
let pulls = grove_providers::merged_pulls_following_moves(forge.as_ref(), owner, name)
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(pulls
|
||||
.into_iter()
|
||||
|
||||
Reference in new issue
Block a user