File tree Expand file tree Collapse file tree
src/extensions/default/Git Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -426,6 +426,7 @@ define(function (require, exports) {
426426 . text ( "\u2026" )
427427 . parent ( )
428428 . show ( ) ;
429+ Panel . setBranchName ( "\u2026" , "" ) ;
429430
430431 return Git . getGitRoot ( ) . then ( function ( gitRoot ) {
431432 var projectRoot = Utils . getProjectRoot ( ) ,
@@ -440,6 +441,7 @@ define(function (require, exports) {
440441 $gitBranchName
441442 . off ( "click" )
442443 . text ( "not a git repo" ) ;
444+ Panel . setBranchName ( "not a git repo" , "" ) ;
443445 Panel . disable ( "not-repo" ) ;
444446
445447 return ;
@@ -482,6 +484,7 @@ define(function (require, exports) {
482484 . attr ( "title" , tooltip )
483485 . off ( "click" )
484486 . on ( "click" , toggleDropdown ) ;
487+ Panel . setBranchName ( branchName , tooltip ) ;
485488 Panel . enable ( ) ;
486489
487490 } ) . catch ( function ( err ) {
@@ -493,6 +496,7 @@ define(function (require, exports) {
493496 $gitBranchName
494497 . off ( "click" )
495498 . text ( "no branch" ) ;
499+ Panel . setBranchName ( "no branch" , "" ) ;
496500 Panel . enable ( ) ;
497501 } else {
498502 throw ex ;
Original file line number Diff line number Diff line change @@ -852,6 +852,19 @@ define(function (require, exports) {
852852 }
853853 }
854854
855+ const BRANCH_MAX_LEN = 18 ;
856+
857+ // called by Branch.refresh() so the panel indicator always mirrors the sidebar one,
858+ // including merge/rebase decorations like "main|MERGING"
859+ function setBranchName ( branchName , tooltip ) {
860+ const displayName = branchName . length > BRANCH_MAX_LEN
861+ ? branchName . substring ( 0 , BRANCH_MAX_LEN ) + "\u2026"
862+ : branchName ;
863+ const $branch = $gitPanel . find ( ".git-panel-branch" ) ;
864+ $branch . attr ( "title" , tooltip || "" ) ;
865+ $branch . find ( ".git-branch-name" ) . text ( displayName ) ;
866+ }
867+
855868 function refreshCommitCounts ( ) {
856869 // Find Push and Pull buttons
857870 var $pullBtn = $gitPanel . find ( ".git-pull" ) ;
@@ -1601,6 +1614,7 @@ define(function (require, exports) {
16011614 exports . toggle = toggle ;
16021615 exports . enable = enable ;
16031616 exports . disable = disable ;
1617+ exports . setBranchName = setBranchName ;
16041618 exports . getSelectedHistoryCommit = getSelectedHistoryCommit ;
16051619 exports . getPanel = function ( ) { return $gitPanel ; } ;
16061620
Original file line number Diff line number Diff line change 10881088 right : 32px ;
10891089 top : 5px ;
10901090 }
1091+ .git-panel-branch {
1092+ display : inline-block ;
1093+ vertical-align : middle ;
1094+ margin-right : 10px ;
1095+ font-size : 12px ;
1096+ white-space : nowrap ;
1097+ cursor : default ;
1098+ opacity : .7 ;
1099+ .dark & {
1100+ opacity : .6 ;
1101+ }
1102+ i {
1103+ margin-right : 4px ;
1104+ }
1105+ }
10911106 .octicon :not (:only-child ) {
10921107 margin-right : 5px ;
10931108 vertical-align : -1px ;
Original file line number Diff line number Diff line change 5757 </ div >
5858 <!-- on right -->
5959 < div class ="git-right-icons hide-when-small ">
60+ < div class ="git-panel-branch git-available ">
61+ < i class ="fas fa-code-branch "> </ i > < span class ="git-branch-name "> </ span >
62+ </ div >
6063 < div class ="btn-group git-available dropup ">
6164 < ul class ="dropdown-menu git-remotes-dropdown "> </ ul >
6265 < button type ="button " class ="git-remotes btn small dropdown-toggle " data-toggle ="dropdown " title ="{{S.TOOLTIP_PICK_REMOTE}} ">
You can’t perform that action at this time.
0 commit comments