Skip to content

bug: git failure when branch and filename collide #190

@kochie

Description

@kochie

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

release/bin/release.js

Lines 316 to 323 in 5b434c9

try {
const unordered = await getTags({
previousTag: flags.previousTag
});
tags = unordered.sort((a, b) => new Date(b.date) - new Date(a.date));
} catch (err) {
fail('Directory is not a Git repository.');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions