RomanHotsiy / commitgpt

Automatically generate commit messages using ChatGPT
1.57k stars 92 forks source link

Pathspec issue on windows #7

Open martic opened 1 year ago

martic commented 1 year ago

Does the Commit message need to include the filenames included in the commit?

I have ran commitgpt a few times for this commit and none of the suggestions include the filename. But it looks as if the filename is required in the commit message.

√ Pick a message · Update password reset duration to 60 minutes
error: pathspec 'password' did not match any file(s) known to git
error: pathspec 'reset' did not match any file(s) known to git
error: pathspec 'duration' did not match any file(s) known to git
error: pathspec 'to' did not match any file(s) known to git
error: pathspec '60' did not match any file(s) known to git
error: pathspec 'minutes'' did not match any file(s) known to git
Aborted.
Error: Command failed: git commit -m 'Update password reset duration to 60 minutes'
    at checkExecSyncError (node:child_process:871:11)
    at execSync (node:child_process:943:15)
    at file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:122:25
    at step (file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:33:23)
    at Object.next (file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:14:53)
    at fulfilled (file:///C:/Users/xxxxxx/AppData/Local/npm-cache/_npx/de3899c053a47706/node_modules/commitgpt/dist/index.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 22868,
  stdout: null,
  stderr: null
}
RomanHotsiy commented 1 year ago

I'm not clear on what you mean. Can you provide more details?

martic commented 1 year ago

I'm running in Poweshell on windows. I think when it generates the commit and sends it to execSync that maybe windows needs it in double quotes.

execSync("git commit -m '".concat(answer.message.replace(/'/, "\'"), "'"), { stdio: 'inherit' });

git commit -m 'Update password reset duration to 60 minutes'

It looks as if pathSpec is interpreting each word of the commit as separate parameters hence pathspec errors. error: pathspec 'password' did not match any file(s) known to git error: pathspec 'reset' did not match any file(s) known to git error: pathspec 'duration' did not match any file(s) known to git

bjornkpu commented 1 year ago

I have the same issue.

OS: Windows 11. Terminals: Visual studio integrated terminal, windows terminal, bash with both PowerShell v17.4.2 and Ubuntu 20.04 LTS