bug: git failure when branch and filename collide

Open Beginner friendly
#190 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
git, javascript
Domain
cli, release

Research direction

Start at bin/release.js lines 316-323 and inspect the Git log invocation shown in the report. Reproduce the failure with a branch and file or directory sharing the same name, then verify the release command completes without Git's ambiguous-argument error.

Written by the indexing model from the issue text.

Description

I assume this is related to #186

When you have a file/directory with the same name as the branch you get an error.

ChildProcessError: Command failed: git log --simplify-by-decoration --pretty="%d;%H;%ci" --decorate=short HEAD --first-parent `git rev-parse --abbrev-ref HEAD`
fatal: ambiguous argument 'main': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
ChildProcessError: Command failed: git log --simplify-by-decoration --pretty="%d;%H;%ci" --decorate=short HEAD --first-parent `git rev-parse --abbrev-ref HEAD`
fatal: ambiguous argument 'main': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
 `git log --simplify-by-decoration --pretty="%d;%H;%ci" --decorate=short HEAD --first-parent `git rev-parse --abbrev-ref HEAD`` (exited with error code 128)
    at callback (/Users/robekoc/projects/personal/release/node_modules/child-process-promise/lib/index.js:33:27)
    at ChildProcess.exithandler (node:child_process:395:5)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1090:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:715:12) {
  code: 128,
  childProcess: {
    _forkChild: [Function: _forkChild],
    ChildProcess: [Function: ChildProcess],
    exec: [Function: exec],
    execFile: [Function: execFile],
    execFileSync: [Function: execFileSync],
    execSync: [Function: execSync],
    fork: [Function: fork],
    spawn: [Function: spawn],
    spawnSync: [Function: spawnSync]
  },
  stdout: '',
  stderr: "fatal: ambiguous argument 'main': both revision and filename\n" +
    "Use '--' to separate paths from revisions, like this:\n" +
    "'git <command> [<revision>...] -- [<file>...]'\n"
}
Error! Directory is not a Git repository.

Failing in https://github.com/vercel/release/blob/5b434c96e8809b2c9b287ea17124887e260d8aab/bin/release.js#L316-L323

Dominant language
JavaScript
Stars
3.6k
Forks
117
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vercel/release

All issues in vercel/release

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.