mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 01:25:42 -05:00
Fixes #20: adds gitlens.advanced.gitignore.enabled
Nested .gitignore files can cause blame to fail with a repo within another repo
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
---
|
||||
## Release Notes
|
||||
|
||||
### 1.4.1
|
||||
- Adds `gitlens.advanced.gitignore.enabled` to enable/disable .gitignore parsing. Addresses [#20](https://github.com/eamodio/vscode-gitlens/issues/20) - Nested .gitignore files can cause blame to fail with a repo within another repo
|
||||
|
||||
### 1.4.0
|
||||
|
||||
- Adds `alt+h` shortcut for the `gitlens.showQuickFileHistory` command
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gitlens",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"author": {
|
||||
"name": "Eric Amodio",
|
||||
"email": "eamodio@gmail.com"
|
||||
@@ -226,6 +226,11 @@
|
||||
"default": null,
|
||||
"description": "Specifies a git path to use"
|
||||
},
|
||||
"gitlens.advanced.gitignore.enabled": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Specifies whether or not to parse the root .gitignore file for better performance (i.e. avoids blaming excluded files)"
|
||||
},
|
||||
"gitlens.advanced.maxQuickHistory": {
|
||||
"type": "number",
|
||||
"default": 200,
|
||||
|
||||
@@ -92,6 +92,9 @@ export interface IAdvancedConfig {
|
||||
};
|
||||
debug: boolean;
|
||||
git: string;
|
||||
gitignore: {
|
||||
enabled: boolean;
|
||||
};
|
||||
maxQuickHistory: number;
|
||||
output: {
|
||||
level: OutputLevel;
|
||||
|
||||
@@ -45,6 +45,7 @@ enum RemoveCacheReason {
|
||||
export default class GitProvider extends Disposable {
|
||||
private _gitCache: Map<string, GitCacheEntry> | undefined;
|
||||
private _cacheDisposable: Disposable | undefined;
|
||||
private _repoPath: string;
|
||||
private _uriCache: Map<string, UriCacheEntry> | undefined;
|
||||
|
||||
config: IConfig;
|
||||
@@ -58,27 +59,10 @@ export default class GitProvider extends Disposable {
|
||||
constructor(private context: ExtensionContext) {
|
||||
super(() => this.dispose());
|
||||
|
||||
const repoPath = context.workspaceState.get(WorkspaceState.RepoPath) as string;
|
||||
this._repoPath = context.workspaceState.get(WorkspaceState.RepoPath) as string;
|
||||
|
||||
this._onConfigure();
|
||||
|
||||
this._gitignore = new Promise<ignore.Ignore | undefined>((resolve, reject) => {
|
||||
const gitignorePath = path.join(repoPath, '.gitignore');
|
||||
fs.exists(gitignorePath, e => {
|
||||
if (e) {
|
||||
fs.readFile(gitignorePath, 'utf8', (err, data) => {
|
||||
if (!err) {
|
||||
resolve(ignore().add(data));
|
||||
return;
|
||||
}
|
||||
resolve(undefined);
|
||||
});
|
||||
return;
|
||||
}
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
const subscriptions: Disposable[] = [];
|
||||
|
||||
subscriptions.push(workspace.onDidChangeConfiguration(this._onConfigure, this));
|
||||
@@ -146,6 +130,28 @@ export default class GitProvider extends Disposable {
|
||||
this._gitCache && this._gitCache.clear();
|
||||
this._gitCache = undefined;
|
||||
}
|
||||
|
||||
this._gitignore = new Promise<ignore.Ignore | undefined>((resolve, reject) => {
|
||||
if (!config.advanced.gitignore.enabled) {
|
||||
resolve(undefined);
|
||||
return;
|
||||
}
|
||||
|
||||
const gitignorePath = path.join(this._repoPath, '.gitignore');
|
||||
fs.exists(gitignorePath, e => {
|
||||
if (e) {
|
||||
fs.readFile(gitignorePath, 'utf8', (err, data) => {
|
||||
if (!err) {
|
||||
resolve(ignore().add(data));
|
||||
return;
|
||||
}
|
||||
resolve(undefined);
|
||||
});
|
||||
return;
|
||||
}
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this.config = config;
|
||||
|
||||
Reference in New Issue
Block a user