disable undo last commit action when dirty

fixes #11477
This commit is contained in:
Joao Moreno
2016-09-28 12:43:23 +02:00
parent f85702522e
commit b4eebbde21

View File

@@ -1150,6 +1150,21 @@ export class UndoLastCommitAction extends GitAction {
super(UndoLastCommitAction.ID, UndoLastCommitAction.LABEL, 'git-action undo-last-commit', gitService);
}
protected isEnabled():boolean {
if (!this.gitService) {
return false;
}
if (!this.gitService.isIdle()) {
return false;
}
var status = this.gitService.getModel().getStatus();
return status.getIndexStatus().all().length === 0
&& status.getWorkingTreeStatus().all().length === 0;
}
public run():Promise {
return this.gitService.reset('HEAD~');
}