upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/git
diff options
context:
space:
mode:
Diffstat (limited to 'src/git')
-rw-r--r--src/git/handlers.rs66
-rw-r--r--src/git/sync.rs2
2 files changed, 26 insertions, 42 deletions
diff --git a/src/git/handlers.rs b/src/git/handlers.rs
index 5ff3a7f..b615251 100644
--- a/src/git/handlers.rs
+++ b/src/git/handlers.rs
@@ -154,13 +154,10 @@ pub async fn handle_upload_pack(
154 154
155 // Write request to git's stdin 155 // Write request to git's stdin
156 if let Some(mut stdin) = git.take_stdin() { 156 if let Some(mut stdin) = git.take_stdin() {
157 stdin 157 stdin.write_all(&request_body).await.map_err(|e| {
158 .write_all(&request_body) 158 error!("Failed to write to git upload-pack stdin: {}", e);
159 .await 159 GitError::IoError(e)
160 .map_err(|e| { 160 })?;
161 error!("Failed to write to git upload-pack stdin: {}", e);
162 GitError::IoError(e)
163 })?;
164 // Close stdin to signal end of input 161 // Close stdin to signal end of input
165 drop(stdin); 162 drop(stdin);
166 } 163 }
@@ -171,24 +168,18 @@ pub async fn handle_upload_pack(
171 168
172 if let Some(stdout) = git.take_stdout() { 169 if let Some(stdout) = git.take_stdout() {
173 let mut stdout = stdout; 170 let mut stdout = stdout;
174 stdout 171 stdout.read_to_end(&mut output).await.map_err(|e| {
175 .read_to_end(&mut output) 172 error!("Failed to read git upload-pack stdout: {}", e);
176 .await 173 GitError::IoError(e)
177 .map_err(|e| { 174 })?;
178 error!("Failed to read git upload-pack stdout: {}", e);
179 GitError::IoError(e)
180 })?;
181 } 175 }
182 176
183 if let Some(stderr) = git.take_stderr() { 177 if let Some(stderr) = git.take_stderr() {
184 let mut stderr = stderr; 178 let mut stderr = stderr;
185 stderr 179 stderr.read_to_end(&mut stderr_output).await.map_err(|e| {
186 .read_to_end(&mut stderr_output) 180 error!("Failed to read git upload-pack stderr: {}", e);
187 .await 181 GitError::IoError(e)
188 .map_err(|e| { 182 })?;
189 error!("Failed to read git upload-pack stderr: {}", e);
190 GitError::IoError(e)
191 })?;
192 } 183 }
193 184
194 // Wait for process 185 // Wait for process
@@ -317,13 +308,10 @@ pub async fn handle_receive_pack(
317 308
318 // Write request to git's stdin 309 // Write request to git's stdin
319 if let Some(mut stdin) = git.take_stdin() { 310 if let Some(mut stdin) = git.take_stdin() {
320 stdin 311 stdin.write_all(&request_body).await.map_err(|e| {
321 .write_all(&request_body) 312 error!("Failed to write to git receive-pack stdin: {}", e);
322 .await 313 GitError::IoError(e)
323 .map_err(|e| { 314 })?;
324 error!("Failed to write to git receive-pack stdin: {}", e);
325 GitError::IoError(e)
326 })?;
327 drop(stdin); 315 drop(stdin);
328 } 316 }
329 317
@@ -333,24 +321,18 @@ pub async fn handle_receive_pack(
333 321
334 if let Some(stdout) = git.take_stdout() { 322 if let Some(stdout) = git.take_stdout() {
335 let mut stdout = stdout; 323 let mut stdout = stdout;
336 stdout 324 stdout.read_to_end(&mut output).await.map_err(|e| {
337 .read_to_end(&mut output) 325 error!("Failed to read git receive-pack stdout: {}", e);
338 .await 326 GitError::IoError(e)
339 .map_err(|e| { 327 })?;
340 error!("Failed to read git receive-pack stdout: {}", e);
341 GitError::IoError(e)
342 })?;
343 } 328 }
344 329
345 if let Some(stderr) = git.take_stderr() { 330 if let Some(stderr) = git.take_stderr() {
346 let mut stderr = stderr; 331 let mut stderr = stderr;
347 stderr 332 stderr.read_to_end(&mut stderr_output).await.map_err(|e| {
348 .read_to_end(&mut stderr_output) 333 error!("Failed to read git receive-pack stderr: {}", e);
349 .await 334 GitError::IoError(e)
350 .map_err(|e| { 335 })?;
351 error!("Failed to read git receive-pack stderr: {}", e);
352 GitError::IoError(e)
353 })?;
354 } 336 }
355 337
356 // Wait for process 338 // Wait for process
diff --git a/src/git/sync.rs b/src/git/sync.rs
index 9a02ad4..05dcbda 100644
--- a/src/git/sync.rs
+++ b/src/git/sync.rs
@@ -814,6 +814,7 @@ pub fn extract_identifier_from_pr_event(event: &Event) -> Option<String> {
814/// 814///
815/// # Returns 815/// # Returns
816/// A `ProcessResult` describing what was processed 816/// A `ProcessResult` describing what was processed
817#[allow(clippy::too_many_arguments)]
817pub async fn process_newly_available_git_data( 818pub async fn process_newly_available_git_data(
818 source_repo_path: &Path, 819 source_repo_path: &Path,
819 new_oids: &HashSet<String>, 820 new_oids: &HashSet<String>,
@@ -1339,6 +1340,7 @@ async fn process_purgatory_pr_events(
1339/// When `write_policy` and `rejected_events_index` are provided (git push path), 1340/// When `write_policy` and `rejected_events_index` are provided (git push path),
1340/// any maintainer announcements sitting in the hot cache are re-processed immediately 1341/// any maintainer announcements sitting in the hot cache are re-processed immediately
1341/// after the owner announcement is promoted, so they don't wait for the next sync cycle. 1342/// after the owner announcement is promoted, so they don't wait for the next sync cycle.
1343#[allow(clippy::too_many_arguments)]
1342async fn process_purgatory_announcements( 1344async fn process_purgatory_announcements(
1343 identifier: &str, 1345 identifier: &str,
1344 source_repo_path: &Path, 1346 source_repo_path: &Path,