upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-07 13:49:46 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-07 13:52:29 +0000
commit41487476bfbe842df61d821df1e3eae06b1c31e2 (patch)
tree793c0a7bcf78f65fa829b56db7440aac1a0aecb5
parent39cfcd950eaf31eb721c25b0e60c751d0f279bb6 (diff)
git: removed duplicate default branch update
this is now handled through process_newly_available_git_data
-rw-r--r--src/git/handlers.rs41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/git/handlers.rs b/src/git/handlers.rs
index c5de5db..6d2e2d7 100644
--- a/src/git/handlers.rs
+++ b/src/git/handlers.rs
@@ -14,7 +14,6 @@ use tracing::{debug, error, info, warn};
14 14
15use super::protocol::{GitService, PktLine}; 15use super::protocol::{GitService, PktLine};
16use super::subprocess::GitSubprocess; 16use super::subprocess::GitSubprocess;
17use super::try_set_head_if_available;
18 17
19use crate::git::authorization::{authorize_push, parse_pushed_refs}; 18use crate::git::authorization::{authorize_push, parse_pushed_refs};
20use crate::git::sync::process_newly_available_git_data; 19use crate::git::sync::process_newly_available_git_data;
@@ -277,36 +276,6 @@ pub async fn handle_receive_pack(
277 return Err(GitError::GitFailed(status.code())); 276 return Err(GitError::GitFailed(status.code()));
278 } 277 }
279 278
280 // GRASP-01: Set HEAD after git data is received
281 // "MUST set repository HEAD per repository state announcement
282 // as soon as the git data related to that branch has been received."
283 //
284 // Note: HEAD setting is also handled by process_newly_available_git_data via
285 // align_repository_with_state, but we do it here first for the pushed-to repo
286 // to ensure it's set immediately after the push succeeds.
287 if let Some(ref state) = auth_result.state {
288 if let Some(head_ref) = &state.head {
289 if let Some(branch_name) = state.get_head_branch() {
290 if let Some(commit) = state.get_branch_commit(branch_name) {
291 match try_set_head_if_available(&repo_path, head_ref, commit) {
292 Ok(true) => {
293 info!("Set HEAD to {} after push to {:?}", head_ref, repo_path);
294 }
295 Ok(false) => {
296 debug!(
297 "HEAD commit {} not found after push, HEAD not updated",
298 commit
299 );
300 }
301 Err(e) => {
302 warn!("Failed to set HEAD after push: {}", e);
303 }
304 }
305 }
306 }
307 }
308 }
309
310 // Process newly available git data using the unified function 279 // Process newly available git data using the unified function
311 // This handles: 280 // This handles:
312 // - Discovering satisfiable events from purgatory (state events and PR events) 281 // - Discovering satisfiable events from purgatory (state events and PR events)
@@ -340,16 +309,16 @@ pub async fn handle_receive_pack(
340 if result.released_any() { 309 if result.released_any() {
341 info!( 310 info!(
342 "Processed push for {}: {} states released, {} PRs released, {} repos synced", 311 "Processed push for {}: {} states released, {} PRs released, {} repos synced",
343 identifier, 312 identifier, result.states_released, result.prs_released, result.repos_synced
344 result.states_released,
345 result.prs_released,
346 result.repos_synced
347 ); 313 );
348 } 314 }
349 315
350 if !result.errors.is_empty() { 316 if !result.errors.is_empty() {
351 for error in &result.errors { 317 for error in &result.errors {
352 warn!("Error during post-push processing for {}: {}", identifier, error); 318 warn!(
319 "Error during post-push processing for {}: {}",
320 identifier, error
321 );
353 } 322 }
354 } 323 }
355 } 324 }