diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e3486d48..128e54699 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/rust/aura-core/src/git.rs b/rust/aura-core/src/git.rs index 0c56be667..256f1b0c1 100644 --- a/rust/aura-core/src/git.rs +++ b/rust/aura-core/src/git.rs @@ -90,6 +90,7 @@ pub fn hash(dir: &Path) -> Result { .stdout .apply(String::from_utf8) .map_err(Error::ReadHash) + .map(|s| s.trim().to_string()) } /// Display the diff between `master` and a given hash. diff --git a/rust/aura-pm/src/command/aur/build.rs b/rust/aura-pm/src/command/aur/build.rs index 0abb47641..c52f9df65 100644 --- a/rust/aura-pm/src/command/aur/build.rs +++ b/rust/aura-pm/src/command/aur/build.rs @@ -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)?; } }