Browse Source

Changes file history to always be the full history

main
Eric Amodio 6 years ago
parent
commit
2cb5b9b37e
2 changed files with 23 additions and 4 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +22
    -4
      src/views/gitExplorer.ts

+ 1
- 0
CHANGELOG.md View File

@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Changed
- Renames the *GitLens History* explorer to *GitLens File History* explorer for better clarity
- Changes the *GitLens File History* explorer to always show the full file history even when reviewing revisions
### Removed
- Removes `gitlens:activeIsTracked`, `gitlens:activeIsBlameable`, `gitlens:activeIsRevision`, and `gitlens:activeHasRemotes` contexts and consolidates them into `gitlens:activeFileStatus` for better performance and UX

+ 22
- 4
src/views/gitExplorer.ts View File

@ -37,6 +37,7 @@ import {
} from './explorerNodes';
import { GitUri } from '../gitService';
import { Logger } from '../logger';
import * as path from 'path';
export * from './explorerNodes';
@ -480,14 +481,31 @@ export class GitExplorer extends Disposable implements TreeDataProvider
// If we do have a visible trackable editor, don't change from the last state (avoids issues when focus switches to the problems/output/debug console panes)
if (editor.document === undefined || !Container.git.isTrackable(editor.document.uri)) return root;
const uri = await GitUri.fromUri(editor.document.uri);
let gitUri = await GitUri.fromUri(editor.document.uri);
const repo = await Container.git.getRepository(uri);
const repo = await Container.git.getRepository(gitUri);
if (repo === undefined) return undefined;
if (UriComparer.equals(uri, root && root.uri)) return root;
let uri;
if (gitUri.sha !== undefined) {
// If we have a sha, normalize the history to the working file (so we get a full history all the time)
const [fileName, repoPath] = await Container.git.findWorkingFileName(
gitUri.fsPath,
gitUri.repoPath,
gitUri.sha
);
if (fileName !== undefined) {
uri = Uri.file(repoPath !== undefined ? path.join(repoPath, fileName) : fileName);
}
}
return new HistoryNode(uri, repo, explorer);
if (UriComparer.equals(uri || gitUri, root && root.uri)) return root;
if (uri !== undefined) {
gitUri = await GitUri.fromUri(uri);
}
return new HistoryNode(gitUri, repo, explorer);
}
static setRenameFollowing(enabled: boolean) {

Loading…
Cancel
Save