Skip to content

Commit acb3214

Browse files
committed
test(node): close ce-review gaps on git ref validation
Add sink tests for @{-1} and pseudoref poisoned rows at diff/merge, HTTP tests that spawn failure returns git_error (500) not bad_request, and expand API boundary cases for remaining pseudorefs and qualified refs. Introduce GITLAWB_TEST_VALIDATE_GIT_BIN test seam with a mutex so parallel sqlx tests do not race on the override.
1 parent 259ef67 commit acb3214

2 files changed

Lines changed: 365 additions & 1 deletion

File tree

‎crates/gitlawb-node/src/git/store.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,17 @@ fn reject_revision_shorthand(name: &str) -> Option<&'static str> {
805805
/// call it too via the `crate::api` re-export to fail fast with a 400, but the
806806
/// guard here is what makes the property hold for every caller and every row,
807807
/// including legacy rows and any writer that skipped the boundary check.
808+
fn validate_git_ref_binary() -> std::borrow::Cow<'static, str> {
809+
#[cfg(test)]
810+
if let Ok(bin) = std::env::var("GITLAWB_TEST_VALIDATE_GIT_BIN") {
811+
return std::borrow::Cow::Owned(bin);
812+
}
813+
std::borrow::Cow::Borrowed("git")
814+
}
815+
808816
pub fn validate_git_ref(name: &str) -> std::result::Result<(), GitRefValidationError> {
809-
validate_git_ref_with_git("git", name)
817+
let git_bin = validate_git_ref_binary();
818+
validate_git_ref_with_git(git_bin.as_ref(), name)
810819
}
811820

812821
fn validate_git_ref_with_git(

0 commit comments

Comments
 (0)