upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/nostr/builder.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-21 16:09:58 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-21 16:09:58 +0000
commit75f3da90edb66b81dbb6ed9806155f6bd7925fe1 (patch)
tree7e0ed637fbce1c406e52f650179a28118d64a816 /src/nostr/builder.rs
parentee7e115b2d0e6a6eee42eb875199c965696017d5 (diff)
remove initial blank commit on bare repo creation
we dont need it
Diffstat (limited to 'src/nostr/builder.rs')
-rw-r--r--src/nostr/builder.rs34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs
index a0b82f4..259c380 100644
--- a/src/nostr/builder.rs
+++ b/src/nostr/builder.rs
@@ -73,40 +73,6 @@ impl Nip34WritePolicy {
73 return Err(format!("git init failed: {}", stderr)); 73 return Err(format!("git init failed: {}", stderr));
74 } 74 }
75 75
76 // Create an initial empty commit so the repository can be cloned
77 // This is required because git clone fails on completely empty repositories
78 let output = std::process::Command::new("git")
79 .args(&[
80 "--git-dir", repo_path.to_str().unwrap(),
81 "commit-tree", "-m", "Initial empty commit",
82 "4b825dc642cb6eb9a060e54bf8d69288fbee4904" // Empty tree hash
83 ])
84 .output()
85 .map_err(|e| format!("Failed to create initial commit: {}", e))?;
86
87 if !output.status.success() {
88 let stderr = String::from_utf8_lossy(&output.stderr);
89 tracing::warn!("Failed to create initial commit (repository may not be cloneable): {}", stderr);
90 // Don't fail here - the repository was created successfully
91 } else {
92 // Extract commit hash from stdout
93 let commit_hash = String::from_utf8_lossy(&output.stdout).trim().to_string();
94
95 // Create master branch pointing to this commit
96 let output = std::process::Command::new("git")
97 .args(&[
98 "--git-dir", repo_path.to_str().unwrap(),
99 "update-ref", "refs/heads/master", &commit_hash
100 ])
101 .output()
102 .map_err(|e| format!("Failed to create master branch: {}", e))?;
103
104 if !output.status.success() {
105 let stderr = String::from_utf8_lossy(&output.stderr);
106 tracing::warn!("Failed to create master branch: {}", stderr);
107 }
108 }
109
110 tracing::info!("Created bare repository at {}", repo_path.display()); 76 tracing::info!("Created bare repository at {}", repo_path.display());
111 Ok(()) 77 Ok(())
112 } 78 }