BCDevOps / nrdk

Natural Resource Ministries Developer/Deployment Kit
3 stars 4 forks source link

Integrate support for Cygwin #40

Closed cghobson closed 3 years ago

cghobson commented 3 years ago

Currently, running a _spawn via cygwin that includes curly-braces evaluates the curly braces. That means that the git rev-parse call is sent literally @u which isn't the name of a branch, so it returns @u, which causes downstream commands to fail.

This block mitigates the problem, but is not beautiful:

    let gitCurrentBranchName = await this._spawn('git', ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'], options)
if (gitCurrentBranchName.stdout.trim() === '@u') {   // catch and counteract bash curly brace evaluation
      gitCurrentBranchName = await this._spawn('git', ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@\\{u\\}'], options)
    }
  }