Browse Source

Fixes issues opening the working file if renamed

main
Eric Amodio 6 years ago
parent
commit
d0354de864
3 changed files with 11 additions and 1 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +7
    -0
      src/commands/openWorkingFile.ts
  3. +3
    -1
      src/gitService.ts

+ 1
- 0
CHANGELOG.md View File

@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#35](https://github.com/eamodio/vscode-gitlens/issues/35) - Copy Commit Sha to Clipboard not working (linux)
- Fixes issue where the last commit of a file history would be broken (failed to parse correctly)
- Fixes issue with *Open Working File* command (`gitlens.openWorkingFile`) failing when a file was renamed
## [8.0.0-beta3] - 2018-02-03
### Added

+ 7
- 0
src/commands/openWorkingFile.ts View File

@ -5,6 +5,7 @@ import { FileAnnotationType } from '../configuration';
import { Container } from '../container';
import { GitUri } from '../gitService';
import { Logger } from '../logger';
import * as path from 'path';
export interface OpenWorkingFileCommandArgs {
uri?: Uri;
@ -31,6 +32,12 @@ export class OpenWorkingFileCommand extends ActiveEditorCommand {
if (uri === undefined) return undefined;
args.uri = await GitUri.fromUri(uri);
if (args.uri instanceof GitUri && args.uri.sha) {
const [fileName, repoPath] = await Container.git.findWorkingFileName(args.uri.fsPath, args.uri.repoPath);
if (fileName !== undefined && repoPath !== undefined) {
args.uri = new GitUri(Uri.file(path.resolve(repoPath, fileName)), repoPath);
}
}
}
if (args.line !== undefined && args.line !== 0) {

+ 3
- 1
src/gitService.ts View File

@ -374,7 +374,9 @@ export class GitService extends Disposable {
repoPath = await this.getRepoPath(fileName, { ref: ref });
[fileName, repoPath] = Git.splitPath(fileName, repoPath);
}
else {
fileName = Strings.normalizePath(path.relative(repoPath, fileName));
}
}
else {
const c = commitOrFileName;

Loading…
Cancel
Save