aboutsummaryrefslogtreecommitdiffstats
path: root/src/access/rules.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/access/rules.rs')
-rw-r--r--src/access/rules.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/access/rules.rs b/src/access/rules.rs
index 9a9e5e2..e151cbb 100644
--- a/src/access/rules.rs
+++ b/src/access/rules.rs
@@ -35,6 +35,10 @@ use crate::document::{ChangeHash, Document, store};
pub(crate) struct Change<'a> {
pub(crate) hash: ChangeHash,
pub(crate) deps: &'a [ChangeHash],
+ /// The heads to judge it at: its dependencies, or, for those not applied yet, the
+ /// changes of the document they build on, where nothing between changed what rules
+ /// read (`access::screen`).
+ pub(crate) seen: &'a [ChangeHash],
/// The node that made it (its node ID), as its signature proves.
pub(crate) committer: Option<&'a str>,
/// The user it names (`User:`), if any.
@@ -77,7 +81,7 @@ pub(crate) fn judge(doc: &Document, epoch: Epoch, change: &Change<'_>) -> Result
))
};
}
- let at = At::new(doc, change.deps).ok_or(Refusal::Unready)?;
+ let at = At::new(doc, change.seen).ok_or(Refusal::Unready)?;
let refuse = |why: String| Err(Refusal::Rule(why));
let Some(node) = change.committer else {
return refuse("it names no node".to_owned());
@@ -239,6 +243,7 @@ mod tests {
&Change {
hash: ChangeHash([9; 32]),
deps: &deps,
+ seen: &deps,
committer: Some(committer),
user,
paths: &touched,
@@ -363,6 +368,7 @@ mod tests {
&Change {
hash: ChangeHash([9; 32]),
deps,
+ seen: deps,
committer: Some("a"),
user: Some("alice"),
paths: &touched,
@@ -386,6 +392,7 @@ mod tests {
&Change {
hash: ChangeHash(hash),
deps: &[],
+ seen: &[],
committer: None,
user: None,
paths: &touched,