upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/git/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/git/mod.rs')
-rw-r--r--src/git/mod.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/git/mod.rs b/src/git/mod.rs
index 494f8b9..a783782 100644
--- a/src/git/mod.rs
+++ b/src/git/mod.rs
@@ -306,11 +306,7 @@ pub fn parse_git_url(path: &str) -> Option<(&str, &str, &str)> {
306 let subpath = parts[2]; 306 let subpath = parts[2];
307 307
308 // Extract identifier (remove .git suffix if present for the middle part) 308 // Extract identifier (remove .git suffix if present for the middle part)
309 let identifier = if repo_part.ends_with(".git") { 309 let identifier = repo_part.strip_suffix(".git").unwrap_or(repo_part);
310 &repo_part[..repo_part.len() - 4]
311 } else {
312 repo_part
313 };
314 310
315 Some((npub, identifier, subpath)) 311 Some((npub, identifier, subpath))
316} 312}
@@ -343,7 +339,12 @@ mod tests {
343 339
344 // Initialize bare repository 340 // Initialize bare repository
345 Command::new("git") 341 Command::new("git")
346 .args(["init", "--bare", "--initial-branch=main", bare_repo.to_str().unwrap()]) 342 .args([
343 "init",
344 "--bare",
345 "--initial-branch=main",
346 bare_repo.to_str().unwrap(),
347 ])
347 .output() 348 .output()
348 .unwrap(); 349 .unwrap();
349 350