Pārlūkot izejas kodu

Closes #321 - re-adds support for single files

main
Eric Amodio pirms 6 gadiem
vecāks
revīzija
cbd5612740
3 mainītis faili ar 27 papildinājumiem un 14 dzēšanām
  1. +4
    -0
      CHANGELOG.md
  2. +9
    -3
      src/git/models/repository.ts
  3. +14
    -11
      src/gitService.ts

+ 4
- 0
CHANGELOG.md Parādīt failu

@ -4,6 +4,10 @@ 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]
### Added
- Adds (re-adds) support for handling single files — closes [#321](https://github.com/eamodio/vscode-gitlens/issues/321)
## [8.3.2] - 2018-05-21
### Fixed
- Fixes [#366](https://github.com/eamodio/vscode-gitlens/issues/366) - Running a GitLens command from a keybinding fails (more cases)

+ 9
- 3
src/git/models/repository.ts Parādīt failu

@ -88,9 +88,15 @@ export class Repository extends Disposable {
) {
super(() => this.dispose());
this.formattedName = root
? folder.name
: `${folder.name} (${_path.relative(folder.uri.fsPath, path)})`;
if (root) {
this.formattedName = folder.name;
}
else {
const relativePath = _path.relative(folder.uri.fsPath, path);
this.formattedName = relativePath
? `${folder.name} (${relativePath})`
: folder.name;
}
this.index = folder.index;
this.name = folder.name;

+ 14
- 11
src/gitService.ts Parādīt failu

@ -1193,7 +1193,7 @@ export class GitService extends Disposable {
if (filePathOrUri instanceof GitUri) return filePathOrUri.repoPath;
// Don't save the tracking info to the cache, because we could be looking in the wrong place (e.g. looking in the root when the file is in a submodule)
const repo = await this.getRepository(filePathOrUri, { ...options, skipCacheUpdate: true });
let repo = await this.getRepository(filePathOrUri, { ...options, skipCacheUpdate: true });
if (repo !== undefined) return repo.path;
if (typeof filePathOrUri !== 'string') {
@ -1209,21 +1209,24 @@ export class GitService extends Disposable {
// If this new repo is inside one of our known roots and we we don't already know about, add it
const root = this._repositoryTree.findSubstr(rp);
const folder = root === undefined
let folder = root === undefined
? workspace.getWorkspaceFolder(Uri.file(rp))
: root.folder;
if (folder !== undefined) {
const repo = new Repository(folder, rp, false, this.onAnyRepositoryChanged.bind(this), this._suspended);
this._repositoryTree.set(rp, repo);
if (folder === undefined) {
const parts = rp.split('/');
folder = { uri: Uri.file(rp), name: parts[parts.length - 1], index: this._repositoryTree.count() };
}
// Send a notification that the repositories changed
setImmediate(async () => {
await this.updateContext(this._repositoryTree);
repo = new Repository(folder, rp, false, this.onAnyRepositoryChanged.bind(this), this._suspended);
this._repositoryTree.set(rp, repo);
this.fireRepositoriesChanged();
});
}
// Send a notification that the repositories changed
setImmediate(async () => {
await this.updateContext(this._repositoryTree);
this.fireRepositoriesChanged();
});
return rp;
}

Notiek ielāde…
Atcelt
Saglabāt