fix: read the configured check set in its on-disk format
commit
c598499fix: read the configured check set in its on-disk format
Wrapping each command in a CheckDef struct changed the refs/meta/checks
tree from checks/<name> blobs to checks/<name>/command subtrees, so loading
a check set written before the change failed with "object … is not a tree" and
broke every push. Store the command directly again, matching the data already
on the server.
Assisted-by: Claude:claude-opus-4-8
Reviews
No reviews of this commit yet — record a verdict below.
Start a review
crates/git-ents/src/checks.rs
@@ -18,18 +18,10 @@
pub const CHECKS_REF: &str = "refs/meta/checks";
/// The check document stored at [`CHECKS_REF`]: its `checks/` subtree maps each
-/// check name to that check's definition (its command).
+/// check name to the command that runs it.
#[derive(Debug, Clone, PartialEq, Eq, Facet)]
struct Checks {
- checks: BTreeMap<String, CheckDef>,
-}
-
-/// One check's stored definition. A struct (rather than a bare command blob) so
-/// each check can grow per-check settings without a tree-format migration.
-#[derive(Debug, Clone, PartialEq, Eq, Facet)]
-struct CheckDef {
- /// The shell command run for the check.
- command: String,
+ checks: BTreeMap<String, String>,
}
/// One configured check recorded in [`CHECKS_REF`].
@@ -62,9 +54,9 @@
Ok(document
.checks
.into_iter()
- .map(|(name, def)| Check {
+ .map(|(name, command)| Check {
name,
- command: def.command.trim_end().to_owned(),
+ command: command.trim_end().to_owned(),
})
.collect())
}
@@ -75,14 +67,7 @@
let document = Checks {
checks: checks
.iter()
- .map(|check| {
- (
- check.name.clone(),
- CheckDef {
- command: check.command.clone(),
- },
- )
- })
+ .map(|check| (check.name.clone(), check.command.clone()))
.collect(),
};
git_store::Store::open(repo)?.store(CHECKS_REF, &document, "Update checks")?;