angular-cn/dev-infra/commit-message
George Kalpakas 34aa5570ed fix(dev-infra): fix commit message validation in git worktrees (#36507)
Previously, the `pre-commit-validate` command (used in the `commit-msg`
git hook) assumed that the commit message was stored in
`.git/COMMIT_EDITMSG` file. This is usually true, but not when using
[git worktrees](https://git-scm.com/docs/git-worktree), where `.git` is
a file containing the path to the actual git directory.

This commit fixes it by taking advantage of the fact that git passes the
actual path of the file holding the commit message to the `commit-msg`
hook and husky exposes the arguments passed by git as
`$HUSKY_GIT_PARAMS`.

NOTE:
We cannot use the environment variable directly in the `commit-msg` hook
command, because environment variables need to be referenced differently
on Windows (`%VAR_NAME%`) vs macOS/Linux (`$VAR_NAME`). Instead, we pass
the name of the environment variable and the validation script reads the
variable's value off of `process.env`.

PR Close #36507
2020-04-09 09:46:18 -07:00
..
BUILD.bazel fix(dev-infra): use commit message validation from @angular/dev-infra-private (#36172) 2020-04-06 09:28:52 -07:00
cli.ts fix(dev-infra): fix commit message validation in git worktrees (#36507) 2020-04-09 09:46:18 -07:00
config.ts fix(dev-infra): use commit message validation from @angular/dev-infra-private (#36172) 2020-04-06 09:28:52 -07:00
validate-file.ts fix(dev-infra): fix commit message validation in git worktrees (#36507) 2020-04-09 09:46:18 -07:00
validate-range.ts fix(dev-infra): use commit message validation from @angular/dev-infra-private (#36172) 2020-04-06 09:28:52 -07:00
validate.spec.ts fix(dev-infra): use commit message validation from @angular/dev-infra-private (#36172) 2020-04-06 09:28:52 -07:00
validate.ts fix(dev-infra): use commit message validation from @angular/dev-infra-private (#36172) 2020-04-06 09:28:52 -07:00