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 13:10:18 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-10 13:10:18 +0000
commit1e7aeb4d7972d29c6586df18128a8a4f7667845a (patch)
tree0f7e5fcaa5a005aeec7ae2d9f35b2c473ef8f785 /test_utils/src/git.rs
parentd2412565334f48bd31e57d29d7959c24258ccd98 (diff)
parentaae452697d152694a8f163219f707356e84b420b (diff)
Make ngit non-interactive by default
Implements non-interactive mode as the default behavior for ngit. Users must now use -i flag for interactive prompts, or provide all required arguments explicitly. Adds -d flag for sensible defaults and -f flag for force operations. Changes: - CLI interactor infrastructure supports non-interactive mode - Global flags: -i (interactive), --defaults (use defaults), -f (force) - ngit init: requires --name or --identifier, supports --defaults - ngit account: new signup command, login supports non-interactive - ngit send: validates required fields, supports --defaults - git-remote-nostr: fixed to prevent interactive prompts during push - Comprehensive test coverage: 234 unit tests + integration tests
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 {