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

Fix copying directories #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CommanderRedYT
Copy link

No description provided.

@Harm-Nullix
Copy link
Collaborator

cpSync is still experimental.

Can you provide some context of what you are trying to do?

The current code loops through the given dir and copies files and dirs when needed,.

@CommanderRedYT
Copy link
Author

I have a folder called githooks.
There is a folder called pre-commit.d with multiple scripts inside. Then, there is a script called pre-commit which iterates over all the scripts in the directory in order.

When I use this script, I get an error for copying the first file inside the pre-commit.d directory after the script tried to create the folder. (Added some logging to confirm that)

@CommanderRedYT
Copy link
Author

Also: nodejs/node#53127

@Harm-Nullix
Copy link
Collaborator

Interessting, curious about that output.

Also, it should make more sense then, if cp just copies both folder and files, to replace the copyDir fn on line https://github.com/peacechen/node-git-hooks/pull/7/files#diff-8e53cb956f4b0661996bd517a983cd87fc5ccd2374a7e1eb4bcd9479877ac86eL33 instead of clouding up a child function with cp.

@CommanderRedYT
Copy link
Author

Installing Git hooks...
Error copying Git hooks:  Error: ENOENT: no such file or directory, copyfile '.githooks/pre-commit.d/check-for-unresolved-conflicts' -> '.git/hooks/pre-commit.d/check-for-unresolved-conflicts'
    at Object.copyFileSync (node:fs:2993:3)
    at copy (/home/ccomm/Dokumente/opendtu-react-native/node_modules/node-git-hooks/install-git-hooks.js:57:6)
    at copyDir (/home/ccomm/Dokumente/opendtu-react-native/node_modules/node-git-hooks/install-git-hooks.js:51:7)
    at copyDir (/home/ccomm/Dokumente/opendtu-react-native/node_modules/node-git-hooks/install-git-hooks.js:46:7)
    at installGitHooks (/home/ccomm/Dokumente/opendtu-react-native/node_modules/node-git-hooks/install-git-hooks.js:33:5)
    at Object.<anonymous> (/home/ccomm/Dokumente/opendtu-react-native/node_modules/node-git-hooks/bin/install.js:5:8)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12) {
  errno: -2,
  syscall: 'copyfile',
  code: 'ENOENT',
  path: '.githooks/pre-commit.d/check-for-unresolved-conflicts',
  dest: '.git/hooks/pre-commit.d/check-for-unresolved-conflicts'
}

It works fine after I run mkdir .git/hooks/pre-commit.d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants