Selaa lähdekoodia

Fixes #791 - Notifies about failed checkouts

main
Eric Amodio 5 vuotta sitten
vanhempi
commit
3784836d61
2 muutettua tiedostoa jossa 26 lisäystä ja 2 poistoa
  1. +10
    -0
      CHANGELOG.md
  2. +16
    -2
      src/git/gitService.ts

+ 10
- 0
CHANGELOG.md Näytä tiedosto

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- Fixes [#791](https://github.com/eamodio/vscode-gitlens/issues/791) - Notification of unstashed changes in working directory on failed checkout
## [9.8.5] - 2019-07-10
### Changed
@ -2979,6 +2985,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Initial release but still heavily a work in progress.
[9.8.5]: https://github.com/eamodio/vscode-gitlens/compare/v9.8.4...eamodio:v9.8.5
[9.8.4]: https://github.com/eamodio/vscode-gitlens/compare/v9.8.3...eamodio:v9.8.4
[9.8.3]: https://github.com/eamodio/vscode-gitlens/compare/v9.8.2...eamodio:v9.8.3
[9.8.2]: https://github.com/eamodio/vscode-gitlens/compare/v9.8.1...eamodio:v9.8.2
[9.8.1]: https://github.com/eamodio/vscode-gitlens/compare/v9.8.0...eamodio:v9.8.1
[9.8.0]: https://github.com/eamodio/vscode-gitlens/compare/v9.7.4...eamodio:v9.8.0
[9.7.4]: https://github.com/eamodio/vscode-gitlens/compare/v9.7.3...eamodio:v9.7.4

+ 16
- 2
src/git/gitService.ts Näytä tiedosto

@ -498,8 +498,22 @@ export class GitService implements Disposable {
}
@log()
checkout(repoPath: string, ref: string, fileName?: string) {
return Git.checkout(repoPath, ref, fileName);
async checkout(repoPath: string, ref: string, fileName?: string) {
const cc = Logger.getCorrelationContext();
try {
return await Git.checkout(repoPath, ref, fileName);
}
catch (ex) {
if (/overwritten by checkout/i.test(ex.message)) {
void Messages.showGenericErrorMessage(`Unable to checkout '${ref}'. Please commit or stash your changes before switching branches`);
return undefined;
}
Logger.error(ex, cc);
void void Messages.showGenericErrorMessage(`Unable to checkout '${ref}'`);
return undefined;
}
}
@gate()

Ladataan…
Peruuta
Tallenna