Skip to content

Commit

Permalink
feat: replace git pull with git fetch + git reset
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Jun 12, 2024
1 parent 575388c commit 03a0fc0
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions buildit-utils/src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,6 @@ pub async fn update_abbs<P: AsRef<Path>>(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")
Expand All @@ -360,6 +349,19 @@ pub async fn update_abbs<P: AsRef<Path>>(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")
Expand Down

0 comments on commit 03a0fc0

Please sign in to comment.