@@ -37,6 +37,8 @@ export interface SetupManager {
37
37
testSetup ( ) : Promise < void > ;
38
38
}
39
39
40
+ export const gitpodSetupBranchName = "gitpod-setup"
41
+
40
42
@injectable ( )
41
43
export class SetupManagerImpl implements SetupManager , FS , CommandContribution {
42
44
@@ -159,7 +161,7 @@ export class SetupManagerImpl implements SetupManager, FS, CommandContribution {
159
161
return ;
160
162
}
161
163
const myLogin = await this . gitHubModel . getMyLogin ( ) ;
162
- const testbranch = myLogin + '/gitpod-setup' ;
164
+ const testbranch = myLogin + '/' + gitpodSetupBranchName ;
163
165
const total = 6 ;
164
166
let done = 1 ;
165
167
const repo = this . repoProvider . selectedRepository ;
@@ -185,8 +187,8 @@ export class SetupManagerImpl implements SetupManager, FS, CommandContribution {
185
187
if ( await this . exists ( this . dockerFileName ) ) {
186
188
filesToAdd . push ( dockerUri . toString ( ) ) ;
187
189
}
188
- const readme = await this . getReadMe ( ) ;
189
- if ( await this . exists ( readme ) ) {
190
+ const readme = await this . getReadMe ( ) . catch ( ( ) => "" ) ;
191
+ if ( readme != "" && await this . exists ( readme ) ) {
190
192
filesToAdd . push ( ( await this . toURI ( readme ) ) . toString ( ) ) ;
191
193
}
192
194
try {
@@ -482,7 +484,7 @@ issue or pull request almost instantly with a single click.
482
484
total : 50
483
485
}
484
486
} ) ;
485
- this . write ( this . dockerFileName ,
487
+ await this . write ( this . dockerFileName ,
486
488
`FROM ${ baseImage }
487
489
488
490
# Install custom tools, runtimes, etc.
@@ -525,7 +527,10 @@ issue or pull request almost instantly with a single click.
525
527
}
526
528
527
529
async hasReadmeConfig ( ) : Promise < boolean > {
528
- const file = await this . getReadMe ( ) ;
530
+ const file = await this . getReadMe ( ) . catch ( ( ) => "" ) ;
531
+ if ( file == "" ) {
532
+ return false ;
533
+ }
529
534
const contents = await this . read ( file ) ;
530
535
const info = await this . infoService . getInfo ( ) ;
531
536
if ( ! contents ) {
@@ -536,17 +541,17 @@ issue or pull request almost instantly with a single click.
536
541
}
537
542
538
543
async updateReadme ( ) : Promise < EditorWidget > {
539
- const fileName = await this . getReadMe ( ) ;
544
+ const fileName = await this . getReadMe ( ) . catch ( ( ) => "README.md" ) ;
540
545
const repo = this . repoProvider . selectedRepository ;
541
546
if ( ! repo ) {
542
547
throw new Error ( 'no repository selected' ) ;
543
548
}
544
549
const remotes = await this . git . remote ( repo ) ;
545
550
const remote = remotes . indexOf ( 'upstream' ) === - 1 ? 'origin' : 'upstream' ;
546
- const content = await this . read ( fileName ) ;
551
+ const content = await this . read ( fileName ) || "" ;
547
552
const contextUrl = await this . getContextUrl ( remote ) ;
548
553
549
- this . write ( fileName ,
554
+ await this . write ( fileName ,
550
555
`[](${ contextUrl } )
551
556
552
557
${ content } `) ;
0 commit comments