mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 23:36:11 +00:00
fix(daemon): leave repos alone while grove add or clone is still building them
Add a .grove-busy marker held by migrate and clone/init, treat a repo as ready only with .bare/HEAD and no marker or .grove-stage, warn once on stale markers. Also re-watch recreated dirs by inode, watch shallow dirs before discovery, and retry failed watches with a rate-limited log. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3784e1533b
commit
e2abeed414
8 files changed
+335
-45
No files matched your search
@@ -19,6 +19,7 @@ use std::process::Command;
|
||||
|
||||
const BARE: &str = ".bare";
|
||||
const STAGE: &str = ".grove-stage";
|
||||
const BUSY: &str = crate::busy::BUSY;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum MigrateError {
|
||||
@@ -477,7 +478,9 @@ fn migrate_inner(
|
||||
let (backup_tar, backup_ref, linked_backups) =
|
||||
backup(&root, &git, machine, backup_dir, stamp, &linked)?;
|
||||
|
||||
let dir = dir_name(&branch, &[BARE, STAGE]);
|
||||
let dir = dir_name(&branch, &[BARE, STAGE, BUSY]);
|
||||
// From here on the daemon must leave the repo alone; dropped last, also after a rollback.
|
||||
let _busy = crate::busy::BusyGuard::acquire(&root)?;
|
||||
let mut p = Progress {
|
||||
orig_ids: list_ids(&root.join(".git")),
|
||||
..Progress::default()
|
||||
@@ -573,7 +576,7 @@ fn run_steps(
|
||||
// 1. Move everything except .git into a staging dir.
|
||||
fs::create_dir(&stage).map_err(s)?;
|
||||
p.staged = true;
|
||||
move_entries(root, &stage, &[".git", STAGE]).map_err(s)?;
|
||||
move_entries(root, &stage, &[".git", STAGE, BUSY]).map_err(s)?;
|
||||
hook(inject, Step::Staged)?;
|
||||
|
||||
// 2. .git -> .bare, make it bare.
|
||||
|
||||
Reference in new issue
Block a user