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

fatal: ambiguous argument 'HEAD1..HEAD' error on Windows #4106

Open
matyasf opened this issue Jul 26, 2024 · 2 comments
Open

fatal: ambiguous argument 'HEAD1..HEAD' error on Windows #4106

matyasf opened this issue Jul 26, 2024 · 2 comments
Labels

Comments

@matyasf
Copy link

matyasf commented Jul 26, 2024

Steps to Reproduce

We are running the following command: commitlint --from=HEAD^1. This works fine on OSX, but fails in Windows 10 (cmd.exe) with the following error:

/node_modules/@commitlint/cli/lib/cli.js:127
        throw err;
        ^

Error: fatal: ambiguous argument 'HEAD1..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

    at Transform.transform [as _transform] (C:\CODE\instructure-ui\node_modules\git-raw-commits\index.js:100:36)
    at Transform._write (node:internal/streams/transform:171:8)
    at writeOrBuffer (node:internal/streams/writable:570:12)
    at _write (node:internal/streams/writable:499:10)
    at Writable.write (node:internal/streams/writable:508:10)
    at Socket.ondata (node:internal/streams/readable:1007:22)
    at Socket.emit (node:events:532:35)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)

Node version: 22

commitlint.config.js:

module.exports = {
  extends: ['@commitlint/config-conventional'],
  parserOpts: {
    headerPattern: /^(\w*)\((\w*)\)-(\w*)\s(.*)$/,
    headerCorrespondence: ['type', 'scope', 'subject']
  },
  // see https://commitlint.js.org/#/reference-rules
  rules: {
    'type-enum': [
      2,
      'always',
      [
        'WIP',
        'feat',
        'fix',
        'docs',
        'chore',
        'style',
        'refactor',
        'test',
        'perf',
        'revert'
      ]
    ],
    'type-case': [0],
    'header-max-length': [0, 'always', 150] // commit message first field (subject) length
  }
}

versions:

"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",

(was producing the same error on v17)

running via Husky



### Current Behavior

crash

### Expected Behavior

no crash

### Affected packages

- [X] cli
- [ ] core
- [ ] prompt
- [ ] config-angular

### Possible Solution

_No response_

### Context

_No response_

### commitlint --version

19.3.0

### git --version

2.45.2.windows.1

### node --version

v22.5.1
@escapedcat
Copy link
Member

Does this duplicate or relate to #6?

@knocte
Copy link
Contributor

knocte commented Aug 31, 2024

We are running the following command: commitlint --from=HEAD^1

What does HEAD^1 mean? is it the same as HEAD~1? And why are you not using --to?

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

No branches or pull requests

3 participants