Skip to content

Posible bug on .checkout(checkoutWhat [, options])  #873

Closed
@blv-rodrigoerades

Description

@blv-rodrigoerades

If I try to use a checkout passing a branch and an array of options like:

simpleGit().checkout('PAY-XXXXX' ,[ '-B'])

I got an error saying:

Error occurred in handler for 'event.cloneUpdateRepo': GitError: error: pathspec 'PAY-XXXXX' did not match any file(s) known to git
error: pathspec 'B' did not match any file(s) known to git

    at Object.action (..../node_modules/simple-git/dist/cjs/index.js:1261:25)
    at PluginStore.exec (...../simple-git/dist/cjs/index.js:1296:29)
    at /...../simple-git/dist/cjs/index.js:1661:43
    at new Promise (<anonymous>)
    at GitExecutorChain.handleTaskData (...../node_modules/simple-git/dist/cjs/index.js:1659:16)
    at GitExecutorChain.<anonymous> (....../node_modules/simple-git/dist/cjs/index.js:1643:44)
    at Generator.next (<anonymous>)
    at fulfilled (......./node_modules/simple-git/dist/cjs/index.js:55:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5) {
  task: {
    commands: [ 'checkout', 'PAY-XXXXX', 'B' ],
    format: 'utf-8',
    parser: [Function: parser]
  }
}

It looks like we are trying to do:

git checkout PAY-XXXXX -B

but parameter should be set before the branch name like:

git checkout -B PAY-XXXXX

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions