File tree Expand file tree Collapse file tree 2 files changed +12
-20
lines changed Expand file tree Collapse file tree 2 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -1654,26 +1654,15 @@ export class GitService implements Disposable {
16541654
16551655 remote = remote ?? 'origin' ;
16561656 try {
1657- const data = await Git . symbolic_ref ( repoPath , `refs/remotes/ ${ remote } /HEAD` ) ;
1657+ const data = await Git . ls_remote__HEAD ( repoPath , remote ) ;
16581658 if ( data == null ) return undefined ;
16591659
1660- return data . trim ( ) . substr ( `${ remote } /` . length ) ;
1661- } catch ( ex ) {
1662- if ( / i s n o t a s y m b o l i c r e f / . test ( ex . stderr ) ) {
1663- try {
1664- const data = await Git . ls_remote__HEAD ( repoPath , remote ) ;
1665- if ( data == null ) return undefined ;
1666-
1667- const match = / r e f : \s ( \S + ) \s + H E A D / m. exec ( data ) ;
1668- if ( match == null ) return undefined ;
1669-
1670- const [ , branch ] = match ;
1671- return branch . substr ( 'refs/heads/' . length ) ;
1672- } catch {
1673- return undefined ;
1674- }
1675- }
1660+ const match = / r e f : \s ( \S + ) \s + H E A D / m. exec ( data ) ;
1661+ if ( match == null ) return undefined ;
16761662
1663+ const [ , branch ] = match ;
1664+ return branch . substr ( 'refs/heads/' . length ) ;
1665+ } catch {
16771666 return undefined ;
16781667 }
16791668 }
Original file line number Diff line number Diff line change @@ -50,9 +50,12 @@ export class CopyOrOpenRemoteCommandQuickPickItem extends CommandQuickPickItem {
5050 }
5151 } else if ( resource . type === RemoteResourceType . CreatePullRequest ) {
5252 let branch = resource . base . branch ;
53- if ( branch == null && this . remote . provider . hasApi ( ) ) {
54- const defaultBranch = await this . remote . provider . getDefaultBranch ?.( ) ;
55- branch = defaultBranch ?. name ;
53+ if ( branch == null ) {
54+ branch = await Container . git . getDefaultBranchName ( this . remote . repoPath , this . remote . name ) ;
55+ if ( branch == null && this . remote . provider . hasApi ( ) ) {
56+ const defaultBranch = await this . remote . provider . getDefaultBranch ?.( ) ;
57+ branch = defaultBranch ?. name ;
58+ }
5659 }
5760
5861 resource = {
You can’t perform that action at this time.
0 commit comments