From 03a0fc0c0fd47f91098ccf850630481b60ecc84c Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Wed, 12 Jun 2024 10:26:42 +0800 Subject: [PATCH] feat: replace git pull with git fetch + git reset --- buildit-utils/src/github.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/buildit-utils/src/github.rs b/buildit-utils/src/github.rs index 361700a..dce8c01 100644 --- a/buildit-utils/src/github.rs +++ b/buildit-utils/src/github.rs @@ -332,17 +332,6 @@ pub async fn update_abbs>(git_ref: &str, abbs_path: P) -> anyhow: print_stdout_and_stderr(&output); - info!("Running git pull ..."); - - let output = process::Command::new("git") - .arg("pull") - .current_dir(abbs_path) - .output() - .instrument(info_span!("git_pull")) - .await?; - - print_stdout_and_stderr(&output); - info!("Running git fetch origin {git_ref} ..."); let output = process::Command::new("git") @@ -360,6 +349,19 @@ pub async fn update_abbs>(git_ref: &str, abbs_path: P) -> anyhow: bail!("Failed to fetch origin git-ref: {git_ref}"); } + info!("Running git reset origin/stable --hard ..."); + + let output = process::Command::new("git") + .arg("reset") + .arg("origin/stable") + .arg("--hard") + .current_dir(abbs_path) + .output() + .instrument(info_span!("git_reset_origin_stable")) + .await?; + + print_stdout_and_stderr(&output); + info!("Running git checkout -b {git_ref} ..."); let output = process::Command::new("git")