Skip to content

Commit

Permalink
fix #5455: stage files from merge group properly
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Also-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Alex Tugarev <alex.tugarev@typefox.io>
  • Loading branch information
AlexTugarev and akosyakov committed Jun 19, 2019
1 parent 67accfe commit 531aa3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/git/src/browser/git-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class GitContribution implements CommandContribution, MenuContribution, T

const registerResourceGroupAction = (group: string, action: MenuAction) => {
menus.registerMenuAction(ScmWidget.RESOURCE_GROUP_INLINE_MENU, action);
menus.registerMenuAction([...ScmWidget.RESOURCE_GROUP_INLINE_MENU, group], action);
menus.registerMenuAction([...ScmWidget.RESOURCE_GROUP_CONTEXT_MENU, group], action);
};

registerResourceGroupAction('1_modification', {
Expand Down
13 changes: 8 additions & 5 deletions packages/git/src/browser/git-scm-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,20 @@ export class GitScmProvider implements ScmProvider {

async stageAll(): Promise<void> {
try {
const { repository, unstagedChanges } = this;
const uris = unstagedChanges.map(c => c.uri);
await this.git.add(repository, uris);
// TODO resolve deletion conflicts
// TODO confirm staging unresolved files
await this.git.add(this.repository, []);
} catch (error) {
this.gitErrorHandler.handleError(error);
}
}
async stage(uri: string): Promise<void> {
try {
const { repository, unstagedChanges } = this;
if (unstagedChanges.some(change => change.uri === uri)) {
const { repository, unstagedChanges, mergeChanges } = this;
const hasUnstagedChanges = unstagedChanges.some(change => change.uri === uri) || mergeChanges.some(change => change.uri === uri);
if (hasUnstagedChanges) {
// TODO resolve deletion conflicts
// TODO confirm staging of a unresolved file
await this.git.add(repository, uri);
}
} catch (error) {
Expand Down

0 comments on commit 531aa3b

Please sign in to comment.