Skip to content

Commit

Permalink
add reproduction attempt for workdir issue typicode#580
Browse files Browse the repository at this point in the history
  • Loading branch information
forivall committed Oct 17, 2019
1 parent 6619e6c commit f3d8af1
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/__tests__/__fixtures__/workdirs/.gitignore
@@ -0,0 +1,2 @@
workdirs
repo
6 changes: 6 additions & 0 deletions src/__tests__/__fixtures__/workdirs/cleanup.sh
@@ -0,0 +1,6 @@
#!/bin/sh

set -e
set -x

rm -rf repo workdirs
20 changes: 20 additions & 0 deletions src/__tests__/__fixtures__/workdirs/package.json
@@ -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'"
}
}
}
30 changes: 30 additions & 0 deletions src/__tests__/__fixtures__/workdirs/run.sh
@@ -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'

0 comments on commit f3d8af1

Please sign in to comment.