Skip to content

Code gets committed although the pre-commit hook fails #15897

@4kochi

Description

@4kochi
  • VSCode Version: 1.8.0-insider (f298203)
  • OS Version: macOS 10.12.1 (16B2657)

Steps to Reproduce:

  1. Change some code
  2. Commit code
  3. Code gets committed, but the pre-commit hook fails

Here is the code of the pre-commit git hook:

#!/bin/sh

# Redirect output to stderr.
exec 1>&2

if [ "$(git status |sed 's/ *//g'|grep modified:)x" != 'x' ] ; then
  echo '### Changes: Running lint and test to avoid committing errors.'
  npm run test
  echo '### Tested.'
fi

When I run the commit command from the shell, the commit is aborted and the code is not committed

git commit -m "Some stuff here"

Metadata

Metadata

Assignees

Labels

invalidIssue identified as not relevant or not valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions