Skip to content

filterdiff removes renames with 100% similarity index #109

@gepbird

Description

@gepbird

Consider this in.diff file that contains a rename with 100% similarity index:

diff --git a/pkgs/applications/networking/msmtp/msmtpq-remove-binary-check.patch b/pkgs/by-name/ms/msmtp/msmtpq-remove-binary-check.patch
similarity index 100%
rename from pkgs/applications/networking/msmtp/msmtpq-remove-binary-check.patch
rename to pkgs/by-name/ms/msmtp/msmtpq-remove-binary-check.patch
diff --git a/pkgs/applications/networking/msmtp/default.nix b/pkgs/by-name/ms/msmtp/package.nix
similarity index 98%
rename from pkgs/applications/networking/msmtp/default.nix
rename to pkgs/by-name/ms/msmtp/package.nix
index 60946106d0ddf1..e2de1f2fe68d84 100644
--- a/pkgs/applications/networking/msmtp/default.nix
+++ b/pkgs/by-name/ms/msmtp/package.nix
@@ -4,7 +4,7 @@
   symlinkJoin,
   lib,
   fetchFromGitHub,
-  autoreconfHook,
+  autoreconfHook269,
   pkg-config,
   bash,
   coreutils,

Using patchutils 0.4.2, running filterdiff in.diff will result in this output, removing the first 100% similar rename:

diff --git a/pkgs/applications/networking/msmtp/default.nix b/pkgs/by-name/ms/msmtp/package.nix
similarity index 98%
rename from pkgs/applications/networking/msmtp/default.nix
rename to pkgs/by-name/ms/msmtp/package.nix
index 60946106d0ddf1..e2de1f2fe68d84 100644
--- a/pkgs/applications/networking/msmtp/default.nix
+++ b/pkgs/by-name/ms/msmtp/package.nix
@@ -4,7 +4,7 @@
   symlinkJoin,
   lib,
   fetchFromGitHub,
-  autoreconfHook,
+  autoreconfHook269,
   pkg-config,
   bash,
   coreutils,

I expect that the rename is kept, it's an important information.

As a workaround excluding a non-existent file produces the desired output with filterdiff -x foo in.diff.

I found this problem in gepbird/nixpkgs-patcher#3, if this is not a bug but an intended behaviour, do you have any suggestions for changing this: https://github.com/NixOS/nixpkgs/blob/3a38dc505f4af26cf5638adb97fbc4118c487e31/pkgs/build-support/fetchpatch/default.nix#L89-L93 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions