mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Merge branch 'master' into fix-executable-bits
This commit is contained in:
@@ -1249,11 +1249,13 @@ export class CommandCenter {
|
||||
promptToSaveFilesBeforeCommit = 'never';
|
||||
}
|
||||
|
||||
const enableSmartCommit = config.get<boolean>('enableSmartCommit') === true;
|
||||
|
||||
if (promptToSaveFilesBeforeCommit !== 'never') {
|
||||
let documents = workspace.textDocuments
|
||||
.filter(d => !d.isUntitled && d.isDirty && isDescendant(repository.root, d.uri.fsPath));
|
||||
|
||||
if (promptToSaveFilesBeforeCommit === 'staged') {
|
||||
if (promptToSaveFilesBeforeCommit === 'staged' || repository.indexGroup.resourceStates.length > 0) {
|
||||
documents = documents
|
||||
.filter(d => repository.indexGroup.resourceStates.some(s => s.resourceUri.path === d.uri.fsPath));
|
||||
}
|
||||
@@ -1275,7 +1277,6 @@ export class CommandCenter {
|
||||
}
|
||||
}
|
||||
|
||||
const enableSmartCommit = config.get<boolean>('enableSmartCommit') === true;
|
||||
const enableCommitSigning = config.get<boolean>('enableCommitSigning') === true;
|
||||
const noStagedChanges = repository.indexGroup.resourceStates.length === 0;
|
||||
const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0;
|
||||
@@ -1370,9 +1371,18 @@ export class CommandCenter {
|
||||
value = (await repository.getCommit(repository.HEAD.commit)).message;
|
||||
}
|
||||
|
||||
const branchName = repository.headShortName;
|
||||
let placeHolder: string;
|
||||
|
||||
if (branchName) {
|
||||
placeHolder = localize('commitMessageWithHeadLabel2', "Message (commit on '{0}')", branchName);
|
||||
} else {
|
||||
placeHolder = localize('commit message', "Commit message");
|
||||
}
|
||||
|
||||
return await window.showInputBox({
|
||||
value,
|
||||
placeHolder: localize('commit message', "Commit message"),
|
||||
placeHolder,
|
||||
prompt: localize('provide commit message', "Please provide a commit message"),
|
||||
ignoreFocusOut: true
|
||||
});
|
||||
@@ -2069,6 +2079,19 @@ export class CommandCenter {
|
||||
await this.runByRepository(resources, async (repository, resources) => repository.ignore(resources));
|
||||
}
|
||||
|
||||
@command('git.revealInExplorer')
|
||||
async revealInExplorer(resourceState: SourceControlResourceState): Promise<void> {
|
||||
if (!resourceState) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(resourceState.resourceUri instanceof Uri)) {
|
||||
return;
|
||||
}
|
||||
|
||||
await commands.executeCommand('revealInExplorer', resourceState.resourceUri);
|
||||
}
|
||||
|
||||
private async _stash(repository: Repository, includeUntracked = false): Promise<void> {
|
||||
const noUnstagedChanges = repository.workingTreeGroup.resourceStates.length === 0;
|
||||
const noStagedChanges = repository.indexGroup.resourceStates.length === 0;
|
||||
|
||||
@@ -579,6 +579,23 @@ export class Repository implements Disposable {
|
||||
return this._refs;
|
||||
}
|
||||
|
||||
get headShortName(): string | undefined {
|
||||
if (!this.HEAD) {
|
||||
return;
|
||||
}
|
||||
|
||||
const HEAD = this.HEAD;
|
||||
const tag = this.refs.filter(iref => iref.type === RefType.Tag && iref.commit === HEAD.commit)[0];
|
||||
const tagName = tag && tag.name;
|
||||
const branchName = HEAD.name || tagName || HEAD.commit;
|
||||
|
||||
if (branchName === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
return branchName.substr(0, 8);
|
||||
}
|
||||
|
||||
private _remotes: Remote[] = [];
|
||||
get remotes(): Remote[] {
|
||||
return this._remotes;
|
||||
@@ -1643,15 +1660,11 @@ export class Repository implements Disposable {
|
||||
}
|
||||
|
||||
private updateInputBoxPlaceholder(): void {
|
||||
const HEAD = this.HEAD;
|
||||
|
||||
if (HEAD) {
|
||||
const tag = this.refs.filter(iref => iref.type === RefType.Tag && iref.commit === HEAD.commit)[0];
|
||||
const tagName = tag && tag.name;
|
||||
const head = HEAD.name || tagName || (HEAD.commit || '').substr(0, 8);
|
||||
const branchName = this.headShortName;
|
||||
|
||||
if (branchName) {
|
||||
// '{0}' will be replaced by the corresponding key-command later in the process, which is why it needs to stay.
|
||||
this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", "{0}", head);
|
||||
this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", "{0}", branchName);
|
||||
} else {
|
||||
this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message ({0} to commit)");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user