diff --git a/CHANGELOG.md b/CHANGELOG.md index 30cb375..faa6bed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,23 +6,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] -## Fixed +### Added + +- Adds new stash behaviors to use the Source Control (commit message) input box — closes [#2081](https://github.com/gitkraken/vscode-gitlens/issues/2081) + - When a stash is applied or popped and the Source Control input is empty, we will now update the Source Control input to the stash message + - When stashing changes and the Source Control input is not empty, we will now default the stash message input to the Source Control input value + +### Fixed - Fixes [#2048](https://github.com/gitkraken/vscode-gitlens/issues/2048) - Gitlens not loading in vscode.dev +- Fixes an issue where the _Stashes_ view empty state isn't displayed properly when there are no stashes ## [12.1.1] - 2022-06-16 -## Added +### Added - Adds getting started tutorial video to the Welcome, Get Started walkthrough, GitLens Home view, and README -## Fixed +### Fixed - Fixes [#2037](https://github.com/gitkraken/vscode-gitlens/issues/2037) - Autolinks can end up getting saved with invalid (cached) properties ## [12.1.0] - 2022-06-14 -## Added +### Added - Adds [**rich integration**](https://github.com/gitkraken/vscode-gitlens#remote-provider-integrations-) with GitLab and GitLab self-managed instances — closes [#1236](https://github.com/gitkraken/vscode-gitlens/issues/1236) - Adds associated pull request to line annotations and hovers @@ -48,7 +55,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - You can now see all autolinks found in the commits in the comparison regardless of whether its a provider-based autolink or a custom (user-provided) autolink - Adds _Open Current Branch on Remote_ to the Command Palette — closes [#1718](https://github.com/gitkraken/vscode-gitlens/issues/1718) -## Changed +### Changed - Improves how stashes are shown in the _Stashes_ view by separating the associated branch from the stash message — closes [#1523](https://github.com/gitkraken/vscode-gitlens/issues/1523) - Changes previous Gerrit remote support to Google Source remote support — thanks to [PR #1954](https://github.com/gitkraken/vscode-gitlens/pull/1954) by Felipe Santos ([@felipecrs](https://github.com/felipecrs)) @@ -56,7 +63,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Renames "Gutter Changes" annotations to "File Changes" - Renames "Gutter Heatmap" annotations to "File Heatmap" -## Fixed +### Fixed - Fixes [#2033](https://github.com/gitkraken/vscode-gitlens/issues/2033) - Diffing, applying, and restoring untracked files in a stash doesn't work - Fixes [#2028](https://github.com/gitkraken/vscode-gitlens/issues/2028) - Branch names with special characters '<' also causes errors on the command line — thanks to [PR #2030](https://github.com/gitkraken/vscode-gitlens/pull/2030) by mcy-kylin ([@mcy-kylin](https://github.com/mcy-kylin)) @@ -70,7 +77,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [12.0.7] - 2022-05-25 -## Fixed +### Fixed - Fixes [#1979](https://github.com/gitkraken/vscode-gitlens/issues/1979) - GitLens stopped working in v12.0.0 and later - Fixes [#1882](https://github.com/gitkraken/vscode-gitlens/issues/1882) - Blame annotations not showing anymore after update @@ -82,7 +89,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [12.0.6] - 2022-04-12 -## Fixed +### Fixed - Fixes [#1928](https://github.com/gitkraken/vscode-gitlens/issues/1928) - Unable to get absolute uri between ex.txt and z:; Base path 'z:' must be an absolute path — thanks to [PR #1929](https://github.com/gitkraken/vscode-gitlens/pull/1929) by Ross Smith II ([@rasa](https://github.com/rasa)) - Fixes [#1932](https://github.com/gitkraken/vscode-gitlens/issues/1932) - Pull request autolink doesn't work for Bitbucket Server 7 — thanks to [PR #1933](https://github.com/gitkraken/vscode-gitlens/pull/1933) by Sam Martin ([@smartinio](https://github.com/smartinio)) diff --git a/src/commands/git/stash.ts b/src/commands/git/stash.ts index 3c6a67a..2374551 100644 --- a/src/commands/git/stash.ts +++ b/src/commands/git/stash.ts @@ -301,6 +301,13 @@ export class StashGitCommand extends QuickCommand { state.subcommand === 'pop' ? `stash@{${state.reference.number}}` : state.reference.ref, { deleteAfter: state.subcommand === 'pop' }, )); + + if (state.reference.message) { + const scmRepository = await this.container.git.getScmRepository(state.repo.path); + if (scmRepository != null && !scmRepository.inputBox.value) { + scmRepository.inputBox.value = state.reference.message; + } + } } catch (ex) { Logger.error(ex, context.title); @@ -467,6 +474,11 @@ export class StashGitCommand extends QuickCommand { while (this.canStepsContinue(state)) { if (state.counter < 3 || state.message == null) { + if (state.message == null) { + const scmRepository = await this.container.git.getScmRepository(state.repo.path); + state.message = scmRepository?.inputBox.value; + } + const result = yield* this.pushCommandInputMessageStep(state, context); // Always break on the first step (so we will go back) if (result === StepResult.Break) break; diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index 837dfa7..b63e2e2 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -4004,6 +4004,18 @@ export class LocalGitProvider implements GitProvider, Disposable { } @log() + async getScmRepository(repoPath: string): Promise { + const cc = Logger.getCorrelationContext(); + try { + const gitApi = await this.getScmGitApi(); + return gitApi?.getRepository(Uri.file(repoPath)) ?? undefined; + } catch (ex) { + Logger.error(ex, cc); + return undefined; + } + } + + @log() async getOrOpenScmRepository(repoPath: string): Promise { const cc = Logger.getCorrelationContext(); try { diff --git a/src/git/gitProvider.ts b/src/git/gitProvider.ts index 135a0e7..20811d7 100644 --- a/src/git/gitProvider.ts +++ b/src/git/gitProvider.ts @@ -119,6 +119,7 @@ export interface GitProvider extends Disposable { visibility(repoPath: string): Promise; getOpenScmRepositories(): Promise; + getScmRepository(repoPath: string): Promise; getOrOpenScmRepository(repoPath: string): Promise; canHandlePathOrUri(scheme: string, pathOrUri: string | Uri): string | undefined; diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index 6cfcc9f..addcc8d 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -2305,7 +2305,13 @@ export class GitProviderService implements Disposable { } @log() - async getOrOpenScmRepository(repoPath: string): Promise { + getScmRepository(repoPath: string): Promise { + const { provider, path } = this.getProvider(repoPath); + return provider.getScmRepository(path); + } + + @log() + getOrOpenScmRepository(repoPath: string): Promise { const { provider, path } = this.getProvider(repoPath); return provider.getOrOpenScmRepository(path); } diff --git a/src/plus/github/githubGitProvider.ts b/src/plus/github/githubGitProvider.ts index 530cbd6..59299da 100644 --- a/src/plus/github/githubGitProvider.ts +++ b/src/plus/github/githubGitProvider.ts @@ -237,6 +237,10 @@ export class GitHubGitProvider implements GitProvider, Disposable { return []; } + async getScmRepository(_repoPath: string): Promise { + return undefined; + } + async getOrOpenScmRepository(_repoPath: string): Promise { return undefined; } diff --git a/src/views/stashesView.ts b/src/views/stashesView.ts index 3756a8b..7a1e05b 100644 --- a/src/views/stashesView.ts +++ b/src/views/stashesView.ts @@ -67,7 +67,7 @@ export class StashesViewNode extends RepositoriesSubscribeableNode