Enhance git sync command to include worktree URI for better context

This commit is contained in:
Osvaldo Ortega
2026-02-27 10:35:02 -08:00
parent d752c031a2
commit 0bf24b7b5e
2 changed files with 5 additions and 3 deletions
@@ -81,13 +81,13 @@ export class SyncIndicator extends Disposable {
this._renderDisposables.add(dom.addDisposableListener(button, dom.EventType.CLICK, (e) => {
dom.EventHelper.stop(e, true);
this.commandService.executeCommand(GIT_SYNC_COMMAND);
this.commandService.executeCommand(GIT_SYNC_COMMAND, this._repository?.rootUri);
}));
this._renderDisposables.add(dom.addDisposableListener(button, dom.EventType.KEY_DOWN, (e) => {
if (e.key === 'Enter' || e.key === ' ') {
dom.EventHelper.stop(e, true);
this.commandService.executeCommand(GIT_SYNC_COMMAND);
this.commandService.executeCommand(GIT_SYNC_COMMAND, this._repository?.rootUri);
}
}));
@@ -112,7 +112,9 @@ function registerSyncAction(behind: number, ahead: number): IDisposable {
override async run(accessor: ServicesAccessor): Promise<void> {
const commandService = accessor.get(ICommandService);
await commandService.executeCommand('git.sync');
const sessionManagementService = accessor.get(ISessionsManagementService);
const worktreeUri = sessionManagementService.getActiveSession()?.worktree;
await commandService.executeCommand('git.sync', worktreeUri);
}
}
return registerAction2(SynchronizeChangesAction);