ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.26k stars 287 forks source link

Override commit.gpgsign when creating patch-file #456

Open FibreFoX opened 1 year ago

FibreFoX commented 1 year ago

I have a local setup, where my global git-settings contains the following setting:

[commit]
  gpgsign = true

This creates a problem while creating a patch-file, which fails because there is no git-key configured (I manage these on local repository level ... yes I am weird, but this forces me to sign my commits properly).

I've created a patch-file for this (haha), which explicitly overrides that setting:

diff --git a/node_modules/patch-package/dist/makePatch.js b/node_modules/patch-package/dist/makePatch.js
index a76e39c..86dce12 100644
--- a/node_modules/patch-package/dist/makePatch.js
+++ b/node_modules/patch-package/dist/makePatch.js
@@ -117,6 +117,8 @@ function makePatch({ packagePathSpecifier, appPath, packageManager, includePaths
         git("init");
         git("config", "--local", "user.name", "patch-package");
         git("config", "--local", "user.email", "patch@pack.age");
+        // do not sign this temporary commit
+        git("config", "--local", "commit.gpgsign", "false");
         // remove ignored files first
         filterFiles_1.removeIgnoredFiles(tmpRepoPackagePath, includePaths, excludePaths);
         git("add", "-f", packageDetails.path);

Would you prefer a pull-request for this one?