@@ -39,6 +39,18 @@ const cloneForBranch = (pushDir, branch, context) => __awaiter(this, void 0, voi
3939 signale_1 . default . info ( `Cloning the branch %s from the remote repo` , branch ) ;
4040 const url = misc_1 . getGitUrl ( context ) ;
4141 yield execAsync ( `git -C ${ pushDir } clone --quiet --branch=${ branch } --depth=1 ${ url } .` , true , 'git clone' , true ) ;
42+ if ( ! fs_1 . default . existsSync ( path_1 . default . resolve ( pushDir , '.git' ) ) ) {
43+ yield gitInit ( pushDir ) ;
44+ yield gitCheckout ( pushDir , branch ) ;
45+ }
46+ } ) ;
47+ const gitInit = ( pushDir ) => __awaiter ( this , void 0 , void 0 , function * ( ) {
48+ signale_1 . default . info ( 'Initializing local git repo' ) ;
49+ yield execAsync ( `git -C ${ pushDir } init .` ) ;
50+ } ) ;
51+ const gitCheckout = ( pushDir , branch ) => __awaiter ( this , void 0 , void 0 , function * ( ) {
52+ signale_1 . default . info ( 'Checking out orphan branch %s' , branch ) ;
53+ yield execAsync ( `git -C ${ pushDir } checkout --orphan "${ branch } "` ) ;
4254} ) ;
4355const config = ( pushDir ) => __awaiter ( this , void 0 , void 0 , function * ( ) {
4456 const name = misc_1 . getCommitName ( ) ;
@@ -56,7 +68,7 @@ const commit = (pushDir) => __awaiter(this, void 0, void 0, function* () {
5668const push = ( pushDir , branch , context ) => __awaiter ( this , void 0 , void 0 , function * ( ) {
5769 signale_1 . default . info ( 'Pushing to %s@%s' , misc_1 . getRepository ( context ) , branch ) ;
5870 const url = misc_1 . getGitUrl ( context ) ;
59- yield execAsync ( `git -C ${ pushDir } push --quiet "${ url } " "${ branch } ":"${ branch } "` , false , 'git push' ) ;
71+ yield execAsync ( `git -C ${ pushDir } push --quiet "${ url } " "${ branch } ":"${ branch } "` , true , 'git push' ) ;
6072} ) ;
6173const cloneForBuild = ( buildDir , context ) => __awaiter ( this , void 0 , void 0 , function * ( ) {
6274 signale_1 . default . info ( 'Cloning the working commit from the remote repo for build' ) ;
@@ -93,7 +105,7 @@ const copyFiles = (buildDir, pushDir) => __awaiter(this, void 0, void 0, functio
93105const execAsync = ( command , quiet = false , altCommand = null , suppressError = false ) => new Promise ( ( resolve , reject ) => {
94106 if ( 'string' === typeof altCommand )
95107 signale_1 . default . info ( `Run command: ${ altCommand } ` ) ;
96- if ( ! quiet )
108+ else if ( ! quiet )
97109 signale_1 . default . info ( `Run command: ${ command } ` ) ;
98110 child_process_1 . exec ( command + ( quiet ? ' > /dev/null 2>&1' : '' ) + ( suppressError ? ' || :' : '' ) , ( error , stdout ) => {
99111 if ( error ) {
0 commit comments