forked from typicode/husky
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add reproduction attempt for workdir issue typicode#580
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
workdirs | ||
repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -x | ||
|
||
rm -rf repo workdirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "husky-workdir-repro", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"husky": "^3.0.8" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "node -p 'require(\"husky/package.json\").version'" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -x | ||
|
||
mkdir -p repos/repo | ||
cd repos/repo | ||
git init | ||
git config user.name 'Test User' | ||
git config user.email 'test@example.org' | ||
cp ../package.json . | ||
npm i | ||
git add package.json | ||
[ -f package-lock.json ] && git add package-lock.json | ||
git commit -m 'init' | ||
|
||
mkdir -p ../workdirs | ||
git worktree add ../workdirs/workdir | ||
# Preparing worktree (new branch 'workdir') | ||
# HEAD is now at 6b8dab8 init | ||
# Can't find Husky, skipping post-checkout hook | ||
# You can reinstall it using 'npm install husky --save-dev' or delete this hook | ||
cd ../workdirs/workdir | ||
npm i | ||
cd - # back to "repo" folder | ||
echo 'node_modules' >> .gitignore | ||
git add .gitignore | ||
|
||
# I expected this to error on the hook, but it didn't | ||
git commit -m 'add gitignore' |