Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm patch-commit with a trailing slash on Windows does not work #5449

Closed
johnnyd710 opened this issue Oct 4, 2022 · 1 comment · Fixed by #5455
Closed

pnpm patch-commit with a trailing slash on Windows does not work #5449

johnnyd710 opened this issue Oct 4, 2022 · 1 comment · Fixed by #5455
Assignees

Comments

@johnnyd710
Copy link
Contributor

johnnyd710 commented Oct 4, 2022

pnpm version: 7.13.0

Code to reproduce the issue:

pnpm init
pnpm add is-odd
pnpm patch is-odd@3.0.1
# You can now edit the following folder: C:\Users\JOHN~1.DIM\AppData\Local\Temp\fd0a396a64d0f8056e12c287ac63e662
# add console.log("Hello World") to C:\Users\JOHN~1.DIM\AppData\Local\Temp\fd0a396a64d0f8056e12c287ac63e662\index.js
pnpm patch-commit C:\Users\JOHN~1.DIM\AppData\Local\Temp\fd0a396a64d0f8056e12c287ac63e662\

Expected behavior:

"Hello World" is printed when I run is-odd package. If I try again without the trailing "\", the "Hello World" is printed.
(I did not expect the trailing slash to have that behaviour. For example, the ls command does not differiate between ls dir and ls dir/. At least I should have got an error, spent way too long trying to figure out why it wasn't working.)

Actual behavior:

Changes not applied to node_modules: index.js inside is-odd package in node_modules does not have the console.log I added

Additional information:

  • node -v prints: v16.15.0
  • Windows, macOS, or Linux?: Windows

pnpm patch file:

diff --git a/index.js b/C:/Users/John.DiMatteo/AppData/Local/Temp/fd0a396a64d0f8056e12c287ac63e662/index.js
index 79d1f22a8e7a27efb8841bb83cb682ea1ff3a59c..9082d46a4c3697de6d5b2952462909980893e562 100644
--- a/index.js
+++ b/C:/Users/John.DiMatteo/AppData/Local/Temp/fd0a396a64d0f8056e12c287ac63e662/index.js
@@ -10,6 +10,7 @@
 const isNumber = require('is-number');
 
 module.exports = function isOdd(value) {
+  console.log("Hello World")
   const n = Math.abs(value);
   if (!isNumber(n)) {
     throw new TypeError('expected a number');

Willing to fix and submit a PR

@zkochan
Copy link
Member

zkochan commented Oct 4, 2022

Yes, I see that the patch file is created but node_modules is not updated with the changes. Feel free to work on it. I'll assign it to you.

zkochan added a commit that referenced this issue Oct 5, 2022
…#5455)

pnpm patch-commit did not apply patch if the absolute path to
a directory passed to it contained a trailing slash on Windows,
now the trailing slash is removed

close #5449

Co-authored-by: Zoltan Kochan <z@kochan.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants