mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
Merge branch '34527' of https://github.com/raouldc/vscode into raouldc-34527
This commit is contained in:
@@ -1432,6 +1432,21 @@ export class CommandCenter {
|
||||
await this.runByRepository(resources, async (repository, resources) => repository.ignore(resources));
|
||||
}
|
||||
|
||||
@command('git.stashIncludeUntracked', { repository: true })
|
||||
async stashIncludeUntracked(repository: Repository): Promise<void> {
|
||||
if (repository.workingTreeGroup.resourceStates.length === 0) {
|
||||
window.showInformationMessage(localize('no changes stash', "There are no changes to stash."));
|
||||
return;
|
||||
}
|
||||
|
||||
const message = await this.getStashMessage();
|
||||
|
||||
if (typeof message === 'undefined') {
|
||||
return;
|
||||
}
|
||||
await repository.createStash(message, true);
|
||||
}
|
||||
|
||||
@command('git.stash', { repository: true })
|
||||
async stash(repository: Repository): Promise<void> {
|
||||
if (repository.workingTreeGroup.resourceStates.length === 0) {
|
||||
@@ -1439,10 +1454,7 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const message = await window.showInputBox({
|
||||
prompt: localize('provide stash message', "Optionally provide a stash message"),
|
||||
placeHolder: localize('stash message', "Stash message")
|
||||
});
|
||||
const message = await this.getStashMessage();
|
||||
|
||||
if (typeof message === 'undefined') {
|
||||
return;
|
||||
@@ -1451,6 +1463,13 @@ export class CommandCenter {
|
||||
await repository.createStash(message);
|
||||
}
|
||||
|
||||
private async getStashMessage(): Promise<string | undefined> {
|
||||
return await window.showInputBox({
|
||||
prompt: localize('provide stash message', "Optionally provide a stash message"),
|
||||
placeHolder: localize('stash message', "Stash message")
|
||||
});
|
||||
}
|
||||
|
||||
@command('git.stashPop', { repository: true })
|
||||
async stashPop(repository: Repository): Promise<void> {
|
||||
const stashes = await repository.getStashes();
|
||||
|
||||
@@ -947,10 +947,14 @@ export class Repository {
|
||||
}
|
||||
}
|
||||
|
||||
async createStash(message?: string): Promise<void> {
|
||||
async createStash(message?: string, includeUntracked?: boolean): Promise<void> {
|
||||
try {
|
||||
const args = ['stash', 'save'];
|
||||
|
||||
if (includeUntracked) {
|
||||
args.push('-u');
|
||||
}
|
||||
|
||||
if (message) {
|
||||
args.push('--', message);
|
||||
}
|
||||
|
||||
@@ -716,8 +716,8 @@ export class Repository implements Disposable {
|
||||
return await this.repository.getStashes();
|
||||
}
|
||||
|
||||
async createStash(message?: string): Promise<void> {
|
||||
return await this.run(Operation.Stash, () => this.repository.createStash(message));
|
||||
async createStash(message?: string, includeUntracked?: boolean): Promise<void> {
|
||||
return await this.run(Operation.Stash, () => this.repository.createStash(message, includeUntracked));
|
||||
}
|
||||
|
||||
async popStash(index?: number): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user