Skip to content

Commit

Permalink
Fix bug where --quiet flag is ignored during a git pull
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden committed Jun 23, 2024
1 parent 6c7c0fc commit 3c76e33
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.9.1] - 2024-06-24

### Fixed

- Fix bug where `--quiet` flag was ignored during a `git pull`

## [0.9.0] - 2024-06-23

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tinted-builder-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tinted-builder-rust"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
authors = ["Jamy Golden <[email protected]>", "Tinted Theming <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand Down
17 changes: 11 additions & 6 deletions tinted-builder-rust/src/operations/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,23 @@ fn git_clone(repo_url: &str, target_dir: &Path, is_quiet: bool) -> Result<()> {
Ok(())
}

fn git_pull(repo_path: &Path) -> Result<()> {
fn git_pull(repo_path: &Path, is_quiet: bool) -> Result<()> {
if !repo_path.is_dir() {
return Err(anyhow!(
"Error with git pull. {} is not a directory",
repo_path.display()
));
}

let status = Command::new("git")
.arg("pull")
.current_dir(repo_path)
.stdout(Stdio::null())
let mut cmd = Command::new("git");

cmd.arg("pull").current_dir(repo_path);

if is_quiet {
cmd.stdout(Stdio::null()).stderr(Stdio::null());
}

let status = cmd
.status()
.with_context(|| format!("Failed to execute process in {}", repo_path.display()))?;

Expand Down Expand Up @@ -74,7 +79,7 @@ pub(crate) fn sync(schemes_path: &Path, is_quiet: bool) -> Result<()> {
let is_diff = git_diff(schemes_path)?;

if !is_diff {
git_pull(schemes_path).with_context(|| {
git_pull(schemes_path, is_quiet).with_context(|| {
format!("Error pulling {} from {}", SCHEMES_REPO_NAME, SCHEMES_URL)
})?;

Expand Down

0 comments on commit 3c76e33

Please sign in to comment.