aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2021-06-24 21:18:07 +0200
committerTeddy Wing2021-06-24 21:18:07 +0200
commit85df39e199fa146e22d9cf8ccd635277fe066d12 (patch)
treeebed651a7cdb1059ca92ca0916196c2dc19c27f3 /src/main.rs
parent98ec0eb9370bd12225fde1d8c2ff8b8ace693609 (diff)
downloadreflectub-85df39e199fa146e22d9cf8ccd635277fe066d12.tar.bz2
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.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
1 files changed, 9 insertions, 0 deletions
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<P: AsRef<Path>>(
git::update_description(&repo_path, remote_description)?;
}
+ if let Some(default_branch) = &current_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(())