diff --git a/nix_update/__init__.py b/nix_update/__init__.py index bb18fb3..00bddf3 100644 --- a/nix_update/__init__.py +++ b/nix_update/__init__.py @@ -160,7 +160,10 @@ def git_commit(git_dir: str, package: Package) -> None: if isinstance(package.cargo_lock, CargoLockInSource): cmd.append(package.cargo_lock.path) run(cmd, stdout=None) - if new_version and package.old_version != new_version.number: + if new_version and ( + package.old_version != new_version.number + or (new_version.rev and new_version.rev != package.rev) + ): run( ["git", "-C", git_dir, "commit", "--verbose", "--message", msg], stdout=None ) diff --git a/nix_update/update.py b/nix_update/update.py index ddb2dbb..c0eb48a 100644 --- a/nix_update/update.py +++ b/nix_update/update.py @@ -28,7 +28,11 @@ def replace_version(package: Package) -> bool: if new_version.startswith("v"): new_version = new_version[1:] - if old_version != new_version: + changed = old_version != new_version or ( + package.new_version.rev is not None and package.new_version.rev != package.rev + ) + + if changed: info(f"Update {old_version} -> {new_version} in {package.filename}") with fileinput.FileInput(package.filename, inplace=True) as f: for line in f: @@ -38,7 +42,7 @@ def replace_version(package: Package) -> bool: else: info(f"Not updating version, already {old_version}") - return old_version != new_version + return changed def to_sri(hashstr: str) -> str: