File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ import {
1919import { Git , IGitExtension } from '../tokens' ;
2020import { NewBranchBox } from './NewBranchBox' ;
2121
22+ const CHANGES_ERR_MSG =
23+ 'You have files with changes in current branch. Please commit or discard changed files before' ;
24+
2225export interface IBranchHeaderState {
2326 dropdownOpen : boolean ;
2427 showNewBranchBox : boolean ;
@@ -79,7 +82,7 @@ export class BranchHeader extends React.Component<
7982 } else {
8083 showErrorMessage (
8184 'Switching branch disabled' ,
82- 'You have staged changes in current branch. Please commit / discard them before switching to another branch.'
85+ CHANGES_ERR_MSG + ' switching to another branch.'
8386 ) ;
8487 }
8588 }
@@ -102,7 +105,7 @@ export class BranchHeader extends React.Component<
102105 } else {
103106 showErrorMessage (
104107 'Creating new branch disabled' ,
105- 'You have staged changes in current branch. Please commit / discard them before creating a new branch.'
108+ CHANGES_ERR_MSG + ' creating a new branch.'
106109 ) ;
107110 }
108111 } ;
Original file line number Diff line number Diff line change @@ -198,10 +198,10 @@ export class GitPanel extends React.Component<
198198 stagedFiles = { this . state . stagedFiles }
199199 data = { this . state . branches }
200200 disabled = {
201- this . state . pastCommits . length === 0 ||
202201 ( this . props . settings . composite [
203202 'disableBranchWithChanges'
204- ] as boolean )
203+ ] as boolean ) &&
204+ ( ! ! this . state . unstagedFiles || ! ! this . state . stagedFiles )
205205 }
206206 toggleSidebar = { this . toggleSidebar }
207207 sideBarExpanded = { this . state . isHistoryVisible }
You can’t perform that action at this time.
0 commit comments