Skip to content
This repository was archived by the owner on Apr 30, 2019. It is now read-only.

Commit 916d0eb

Browse files
committed
Elminate implicit property ordering for format version
There is an implicit ordering for setting GithubLoader.formatVersion in the derived class's constructor before finishing initialization via the `GithubLoader::_initGithubLoader()` method. This change removes that implicit ordering and is an incremental step towards eliminating `GithubLoader::_initGithubLoader()`, which will occur in a future commit.
1 parent 96eb46f commit 916d0eb

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

src/git/loader/GithubAPI.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ class GithubAPI extends GithubLoader {
3333

3434
constructor(urls: GithubURLs, options: JSONPointer, shared: JSONPointer, storeDir: string) {
3535
super(urls, options, shared, storeDir, GithubAPI.NAME);
36-
37-
this.formatVersion = GithubAPI.FORMAT_VERSION;
38-
39-
this._initGithubLoader(GithubAPI.CACHE_KEY);
36+
this._initGithubLoader(GithubAPI.CACHE_KEY, GithubAPI.FORMAT_VERSION);
4037
}
4138

4239
getBranches(): Promise<any> {

src/git/loader/GithubLoader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class GithubLoader {
4545
this.label = label;
4646
}
4747

48-
_initGithubLoader(cacheKey: string): void {
48+
_initGithubLoader(cacheKey: string, formatVersion: string): void {
4949
var cache = new CacheOpts();
5050
cache.allowClean = this.options.getBoolean('allowClean', cache.allowClean);
5151
cache.cleanInterval = this.options.getDurationSecs('cacheCleanInterval', cache.cleanInterval / 1000) * 1000;
@@ -70,7 +70,7 @@ class GithubLoader {
7070

7171
this.cache = new HTTPCache(opts);
7272
// required to have some header
73-
this.headers['user-agent'] = this.label + '-v' + this.formatVersion;
73+
this.headers['user-agent'] = this.label + '-v' + formatVersion;
7474
}
7575

7676
copyHeadersTo(target: any, source?: any) {

src/git/loader/GithubRaw.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ class GithubRaw extends GithubLoader {
2525

2626
constructor(urls: GithubURLs, options: JSONPointer, shared: JSONPointer, storeDir: string) {
2727
super(urls, options, shared, storeDir, 'GithubRaw');
28-
29-
this.formatVersion = GithubRaw.FORMAT_VERSION;
30-
31-
this._initGithubLoader(GithubRaw.CACHE_KEY);
28+
this._initGithubLoader(GithubRaw.CACHE_KEY, GithubRaw.FORMAT_VERSION);
3229
}
3330

3431
getText(ref: string, filePath: string): Promise<string> {

0 commit comments

Comments
 (0)