upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/test_utils/src/git.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-10 12:52:19 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-10 13:03:37 +0000
commit09bb21462ac5571cace5a7e71103156772a499fe (patch)
tree2f46a7be3b6398b00acbe6bcdbb7474903e20087 /test_utils/src/git.rs
parent5db638d7350c35649d9fa4faac981395667e0609 (diff)
feat: update ngit init for non-interactive mode
Complete rewrite of ngit init to support non-interactive mode by default. Key changes: - Implement hybrid validation (validate all args upfront, fail fast) - Add --grasp-servers flag for specifying git servers - Prefer --name over --identifier for better UX - Add comprehensive validation with helpful error messages - Support both clone and init-from-existing-repo workflows - Add --force flag to bypass safety checks - Update tests for new non-interactive behavior - Add test utilities for non-interactive testing
Diffstat (limited to 'test_utils/src/git.rs')
-rw-r--r--test_utils/src/git.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test_utils/src/git.rs b/test_utils/src/git.rs
index ab21f38..a18f81c 100644
--- a/test_utils/src/git.rs
+++ b/test_utils/src/git.rs
@@ -282,6 +282,30 @@ impl GitTestRepo {
282 branch.set_upstream(Some(&format!("origin/{branch_name}")))?; 282 branch.set_upstream(Some(&format!("origin/{branch_name}")))?;
283 self.checkout(branch_name) 283 self.checkout(branch_name)
284 } 284 }
285
286 /// Set nostr.repo git config to point to a specific pubkey's coordinate.
287 /// Used for State D/E tests where the coordinate points to another user.
288 pub fn set_nostr_repo_coordinate(
289 &self,
290 pubkey: &nostr::PublicKey,
291 identifier: &str,
292 relays: &[&str],
293 ) {
294 let relay_urls: Vec<nostr::RelayUrl> = relays
295 .iter()
296 .map(|r| nostr::RelayUrl::parse(r).unwrap())
297 .collect();
298 let coordinate = Nip19Coordinate {
299 coordinate: Coordinate::new(nostr::Kind::GitRepoAnnouncement, *pubkey)
300 .identifier(identifier.to_string()),
301 relays: relay_urls,
302 };
303 let _ = self
304 .git_repo
305 .config()
306 .unwrap()
307 .set_str("nostr.repo", &coordinate.to_bech32().unwrap());
308 }
285} 309}
286 310
287impl Drop for GitTestRepo { 311impl Drop for GitTestRepo {