Skip to content

Commit

Permalink
fix(-A): show no diff if the source hashes didn't change
Browse files Browse the repository at this point in the history
Particularly useful with `--git`.

Fixes #912
  • Loading branch information
fosskers committed Aug 14, 2024
1 parent 0f158ef commit 1eb6be0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#### Fixed

- Extra `-debug` packages will not be taken into account when determining packages that need upgrades.
- `-Auk`: don't display a diff (or even ask to) if the hash didn't change. Useful with `--git`.

## 4.0.2 (2024-08-10)

Expand Down
1 change: 1 addition & 0 deletions rust/aura-core/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ pub fn hash(dir: &Path) -> Result<String, Error> {
.stdout
.apply(String::from_utf8)
.map_err(Error::ReadHash)
.map(|s| s.trim().to_string())
}

/// Display the diff between `master` and a given hash.
Expand Down
14 changes: 8 additions & 6 deletions rust/aura-pm/src/command/aur/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,16 @@ fn show_diffs(
) -> Result<(), Error> {
let hashes = env.aur.hashes.as_path();

// Silently skip over any hashes that couldn't be read. This is mostly
// likely due to the package being installed for the first time, thus having
// no history to compare to.
// Silently skip over any hashes that couldn't be read. This is most likely
// due to the package being installed for the first time, thus having no
// history to compare to.
match hash_of_last_install(hashes, pkgbase) {
Err(e) => warn!("Couldn't read latest hash of {}: {}", pkgbase, e),
Ok(hash) => {
if proceed!(fll, env, "A-build-diff").is_some() {
aura_core::git::diff(clone, &hash).map_err(Error::GitDiff)?;
Ok(prev_hash) => {
let curr_hash = aura_core::git::hash(clone).map_err(Error::GitDiff)?;

if prev_hash != curr_hash && proceed!(fll, env, "A-build-diff").is_some() {
aura_core::git::diff(clone, &prev_hash).map_err(Error::GitDiff)?;
proceed!(fll, env, "proceed").ok_or(Error::Cancelled)?;
}
}
Expand Down

0 comments on commit 1eb6be0

Please sign in to comment.