From 85df39e199fa146e22d9cf8ccd635277fe066d12 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 24 Jun 2021 21:18:07 +0200 Subject: main::update(): Change HEAD branch if default branch changed If the default branch on GitHub changed, change the local mirror's HEAD to match the new default. Need to store the default branch in the database now so we can find out whether it changed. --- src/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 0fdc715..878bd73 100644 --- a/src/main.rs +++ b/src/main.rs @@ -278,6 +278,15 @@ fn update>( git::update_description(&repo_path, remote_description)?; } + if let Some(default_branch) = ¤t_repo.default_branch { + if default_branch != &updated_repo.default_branch { + git::change_current_branch( + &repo_path, + &updated_repo.default_branch, + )?; + } + } + update_mtime(&repo_path, &updated_repo)?; Ok(()) -- cgit v1.2.3