@@ -27,7 +27,8 @@ function getAbsoluteElectronExec () {
2727async function handleGitCall ( args , gitDir ) {
2828 const details = await GitProcess . exec ( args , gitDir )
2929 if ( details . exitCode === 0 ) {
30- return details . stdout . trim ( )
30+ const output = details . stdout . replace ( / ^ \* | \s + | \s + $ / , '' )
31+ return output . trim ( )
3132 } else {
3233 const error = GitProcess . parseError ( details . stderr )
3334 console . log ( `${ fail } couldn't parse git process call: ` , error )
@@ -37,10 +38,14 @@ async function handleGitCall (args, gitDir) {
3738
3839async function getCurrentBranch ( gitDir ) {
3940 let branch = await handleGitCall ( [ 'rev-parse' , '--abbrev-ref' , 'HEAD' ] , gitDir )
40- if ( ! branch . match ( / [ 0 - 9 ] + - [ 0 - 9 ] + - x / ) ) {
41+ if ( branch !== 'master' && ! branch . match ( / [ 0 - 9 ] + - [ 0 - 9 ] + - x / ) ) {
4142 const lastCommit = await handleGitCall ( [ 'rev-parse' , 'HEAD' ] , gitDir )
4243 const branches = ( await handleGitCall ( [ 'branch' , '--contains' , lastCommit ] , gitDir ) ) . split ( '\n' )
43- branch = branches . filter ( b => b . match ( / [ 0 - 9 ] + - [ 0 - 9 ] + - x / ) ) [ 0 ] . trim ( )
44+ branch = branches . filter ( b => b === 'master' || b . match ( / [ 0 - 9 ] + - [ 0 - 9 ] + - x / ) ) [ 0 ]
45+ if ( ! branch ) {
46+ console . log ( `${ fail } no release branch exists for this ref` )
47+ process . exit ( 1 )
48+ }
4449 }
4550 return branch
4651}
0 commit comments