Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreadman committed Dec 1, 2024
2 parents 3c4c009 + 30b132d commit bcbb2d5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
19 changes: 15 additions & 4 deletions extensions/git/src/actionButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Command, Disposable, Event, EventEmitter, SourceControlActionButton, Uri, workspace, l10n } from 'vscode';
import { Command, Disposable, Event, EventEmitter, SourceControlActionButton, Uri, workspace, l10n, LogOutputChannel } from 'vscode';
import { Branch, RefType, Status } from './api/git';
import { OperationKind } from './operation';
import { CommitCommandsCenter } from './postCommitCommands';
Expand Down Expand Up @@ -51,13 +51,16 @@ export class ActionButton {

this._state = state;
this._onDidChange.fire();

this.logger.trace(`[ActionButton][setState] ${JSON.stringify(state)}`);
}

private disposables: Disposable[] = [];

constructor(
readonly repository: Repository,
readonly postCommitCommandCenter: CommitCommandsCenter) {
private readonly repository: Repository,
private readonly postCommitCommandCenter: CommitCommandsCenter,
private readonly logger: LogOutputChannel) {
this._state = {
HEAD: undefined,
isCheckoutInProgress: false,
Expand Down Expand Up @@ -102,7 +105,15 @@ export class ActionButton {
}

// Commit Changes (enabled) -> Publish Branch -> Sync Changes -> Commit Changes (disabled)
return actionButton ?? this.getPublishBranchActionButton() ?? this.getSyncChangesActionButton() ?? this.getCommitActionButton();
actionButton = actionButton ?? this.getPublishBranchActionButton() ?? this.getSyncChangesActionButton() ?? this.getCommitActionButton();

this.logger.trace(`[ActionButton][getButton] ${JSON.stringify({
command: actionButton?.command.command,
title: actionButton?.command.title,
enabled: actionButton?.enabled
})}`);

return actionButton;
}

private getCommitActionButton(): SourceControlActionButton | undefined {
Expand Down
2 changes: 1 addition & 1 deletion extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ export class Repository implements Disposable {
this.commitCommandCenter = new CommitCommandsCenter(globalState, this, postCommitCommandsProviderRegistry);
this.disposables.push(this.commitCommandCenter);

const actionButton = new ActionButton(this, this.commitCommandCenter);
const actionButton = new ActionButton(this, this.commitCommandCenter, this.logger);
this.disposables.push(actionButton);
actionButton.onDidChange(() => this._sourceControl.actionButton = actionButton.button);
this._sourceControl.actionButton = actionButton.button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ export class BrowserLifecycleService extends AbstractLifecycleService {
joiners: () => [], // Unsupported in web
token: CancellationToken.None, // Unsupported in web
join(promise, joiner) {
if (typeof promise === 'function') {
promise();
}
logService.error(`[lifecycle] Long running operations during shutdown are unsupported in the web (id: ${joiner.id})`);
},
force: () => { /* No-Op in web */ },
Expand Down

0 comments on commit bcbb2d5

Please sign in to comment.