Skip to content

Commit 65f366a

Browse files
committed
Renames getLogFor{File -> Path} for accuracy
1 parent 08cf659 commit 65f366a

File tree

13 files changed

+41
-41
lines changed

13 files changed

+41
-41
lines changed

src/annotations/gutterChangesAnnotationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class GutterChangesAnnotationProvider extends AnnotationProviderBase<Chan
111111

112112
let localChanges = rev1 == null && rev2 == null;
113113
if (localChanges) {
114-
let rev = await commitsProvider.getOldestUnpushedShaForFile(this.trackedDocument.uri);
114+
let rev = await commitsProvider.getOldestUnpushedShaForPath(this.trackedDocument.uri);
115115
if (rev != null) {
116116
rev = `${rev}^`;
117117
commit = await commitsProvider.getCommitForFile(this.trackedDocument.uri, rev);

src/commands/diffFolderWithRevision.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ export class DiffFolderWithRevisionCommand extends ActiveEditorCommand {
5050

5151
const commitsProvider = this.container.git.commits(repoPath);
5252
const log = commitsProvider
53-
.getLogForFile(gitUri.fsPath)
53+
.getLogForPath(gitUri.fsPath)
5454
.then(
55-
log => log ?? (gitUri.sha ? commitsProvider.getLogForFile(gitUri.fsPath, gitUri.sha) : undefined),
55+
log => log ?? (gitUri.sha ? commitsProvider.getLogForPath(gitUri.fsPath, gitUri.sha) : undefined),
5656
);
5757

5858
const relativePath = this.container.git.getRelativePath(uri, repoPath);

src/commands/diffWithRevision.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
4343
try {
4444
const commitsProvider = this.container.git.commits(gitUri.repoPath!);
4545
const log = commitsProvider
46-
.getLogForFile(gitUri.fsPath)
46+
.getLogForPath(gitUri.fsPath)
4747
.then(
48-
log => log ?? (gitUri.sha ? commitsProvider.getLogForFile(gitUri.fsPath, gitUri.sha) : undefined),
48+
log => log ?? (gitUri.sha ? commitsProvider.getLogForPath(gitUri.fsPath, gitUri.sha) : undefined),
4949
);
5050

5151
const title = `Open Changes with Revision${pad(GlyphChars.Dot, 2, 2)}`;

src/commands/git/log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export class LogGitCommand extends QuickCommand<State> {
164164
if (log == null) {
165165
log =
166166
state.fileName != null
167-
? state.repo.git.commits().getLogForFile(state.fileName, rev)
167+
? state.repo.git.commits().getLogForPath(state.fileName, rev)
168168
: state.repo.git.commits().getLog(rev);
169169
context.cache.set(rev, log);
170170
}

src/commands/openFileAtRevision.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ export class OpenFileAtRevisionCommand extends ActiveEditorCommand {
117117
if (args.revisionUri == null) {
118118
const commitsProvider = this.container.git.commits(gitUri.repoPath!);
119119
const log = commitsProvider
120-
.getLogForFile(gitUri.fsPath)
120+
.getLogForPath(gitUri.fsPath)
121121
.then(
122122
log =>
123-
log ?? (gitUri.sha ? commitsProvider.getLogForFile(gitUri.fsPath, gitUri.sha) : undefined),
123+
log ?? (gitUri.sha ? commitsProvider.getLogForPath(gitUri.fsPath, gitUri.sha) : undefined),
124124
);
125125

126126
const title = `Open ${args.annotationType === 'blame' ? 'Blame' : 'File'} at Revision${pad(

src/env/node/git/sub-providers/commits.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
157157
const [relativePath, root] = splitPath(uri, repoPath);
158158

159159
try {
160-
const log = await this.getLogForFile(root, relativePath, rev, { limit: 2 });
160+
const log = await this.getLogForPath(root, relativePath, rev, { limit: 2 });
161161
if (log == null) return undefined;
162162

163163
let commit;
@@ -633,7 +633,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
633633
}
634634

635635
@log()
636-
async getLogForFile(
636+
async getLogForPath(
637637
repoPath: string | undefined,
638638
pathOrUri: string | Uri,
639639
rev?: string | undefined,
@@ -656,10 +656,10 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
656656
const relativePath = this.provider.getRelativePath(pathOrUri, repoPath);
657657

658658
if (repoPath != null && repoPath === relativePath) {
659-
throw new Error(`File name cannot match the repository path; path=${relativePath}`);
659+
throw new Error(`Path cannot match the repository path; path=${relativePath}`);
660660
}
661661

662-
const opts: typeof options & Parameters<CommitsGitSubProvider['getLogForFileCore']>[6] = {
662+
const opts: typeof options & Parameters<CommitsGitSubProvider['getLogForPathCore']>[6] = {
663663
reverse: false,
664664
...options,
665665
};
@@ -769,7 +769,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
769769
count: commits.size,
770770
commits: commits,
771771
query: (limit: number | undefined) =>
772-
this.getLogForFile(repoPath, pathOrUri, rev, { ...optsCopy, limit: limit }),
772+
this.getLogForPath(repoPath, pathOrUri, rev, { ...optsCopy, limit: limit }),
773773
};
774774

775775
return log;
@@ -783,7 +783,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
783783
doc.state ??= new GitDocumentState();
784784
}
785785

786-
const promise = this.getLogForFileCore(repoPath, relativePath, rev, doc, key, scope, opts);
786+
const promise = this.getLogForPathCore(repoPath, relativePath, rev, doc, key, scope, opts);
787787

788788
if (useCache && doc.state != null) {
789789
Logger.debug(scope, `Cache add: '${key}'`);
@@ -797,7 +797,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
797797
return promise;
798798
}
799799

800-
private async getLogForFileCore(
800+
private async getLogForPathCore(
801801
repoPath: string | undefined,
802802
path: string,
803803
rev: string | undefined,
@@ -870,9 +870,9 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
870870
if (log != null) {
871871
const opts = { ...options, range: range };
872872
log.query = (limit: number | undefined) =>
873-
this.getLogForFile(repoPath, path, rev, { ...opts, limit: limit });
873+
this.getLogForPath(repoPath, path, rev, { ...opts, limit: limit });
874874
if (log.hasMore) {
875-
log.more = this.getLogForFileMoreFn(log, path, rev, opts);
875+
log.more = this.getLogForPathMoreFn(log, path, rev, opts);
876876
}
877877
}
878878

@@ -896,7 +896,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
896896
}
897897
}
898898

899-
private getLogForFileMoreFn(
899+
private getLogForPathMoreFn(
900900
log: GitLog,
901901
relativePath: string,
902902
rev: string | undefined,
@@ -931,7 +931,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
931931
}
932932
}
933933
}
934-
const moreLog = await this.getLogForFile(
934+
const moreLog = await this.getLogForPath(
935935
log.repoPath,
936936
relativePath,
937937
options.all ? undefined : moreUntil == null ? `${sha}^` : `${moreUntil}^..${sha}^`,
@@ -955,7 +955,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
955955
limit: moreUntil == null ? (log.limit ?? 0) + moreLimit : undefined,
956956
hasMore: moreUntil == null ? moreLog.hasMore : true,
957957
query: (limit: number | undefined) =>
958-
this.getLogForFile(log.repoPath, relativePath, rev, { ...options, limit: limit }),
958+
this.getLogForPath(log.repoPath, relativePath, rev, { ...options, limit: limit }),
959959
};
960960

961961
if (options.renames) {
@@ -967,18 +967,18 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
967967
}
968968

969969
if (mergedLog.hasMore) {
970-
mergedLog.more = this.getLogForFileMoreFn(mergedLog, relativePath, rev, options);
970+
mergedLog.more = this.getLogForPathMoreFn(mergedLog, relativePath, rev, options);
971971
}
972972

973973
return mergedLog;
974974
};
975975
}
976976

977977
@log()
978-
async getOldestUnpushedShaForFile(repoPath: string, uri: Uri): Promise<string | undefined> {
979-
const [relativePath, root] = splitPath(uri, repoPath);
978+
async getOldestUnpushedShaForPath(repoPath: string, pathOrUri: string | Uri): Promise<string | undefined> {
979+
const relativePath = this.provider.getRelativePath(pathOrUri, repoPath);
980980

981-
const data = await this.git.log__file(root, relativePath, '@{u}..', {
981+
const data = await this.git.log__file(repoPath, relativePath, '@{u}..', {
982982
argsOrFormat: ['-z', '--format=%H'],
983983
fileMode: 'none',
984984
ordering: configuration.get('advanced.commitOrdering'),

src/git/gitProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export interface GitCommitsSubProvider {
300300
since?: string | undefined;
301301
},
302302
): Promise<Set<string> | undefined>;
303-
getLogForFile(
303+
getLogForPath(
304304
repoPath: string,
305305
pathOrUri: string | Uri,
306306
rev?: string | undefined,
@@ -316,7 +316,7 @@ export interface GitCommitsSubProvider {
316316
skip?: number | undefined;
317317
},
318318
): Promise<GitLog | undefined>;
319-
getOldestUnpushedShaForFile(repoPath: string, uri: Uri): Promise<string | undefined>;
319+
getOldestUnpushedShaForPath(repoPath: string, pathOrUri: string | Uri): Promise<string | undefined>;
320320
isAncestorOf(repoPath: string, rev1: string, rev2: string): Promise<boolean>;
321321
hasCommitBeenPushed(repoPath: string, rev: string): Promise<boolean>;
322322
searchCommits(

src/plus/integrations/providers/github/sub-providers/commits.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
462462
}
463463

464464
@log()
465-
async getLogForFile(
465+
async getLogForPath(
466466
repoPath: string | undefined,
467467
pathOrUri: string | Uri,
468468
rev?: string | undefined,
@@ -591,7 +591,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
591591
count: commits.size,
592592
commits: commits,
593593
query: (limit: number | undefined) =>
594-
this.getLogForFile(repoPath, pathOrUri, rev, { ...opts, limit: limit }),
594+
this.getLogForPath(repoPath, pathOrUri, rev, { ...opts, limit: limit }),
595595
};
596596

597597
return log;
@@ -605,7 +605,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
605605
doc.state ??= new GitDocumentState();
606606
}
607607

608-
const promise = this.getLogForFileCore(repoPath, relativePath, rev, doc, key, scope, options);
608+
const promise = this.getLogForPathCore(repoPath, relativePath, rev, doc, key, scope, options);
609609

610610
if (useCache && doc.state != null) {
611611
Logger.debug(scope, `Cache add: '${key}'`);
@@ -619,7 +619,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
619619
return promise;
620620
}
621621

622-
private async getLogForFileCore(
622+
private async getLogForPathCore(
623623
repoPath: string | undefined,
624624
path: string,
625625
rev: string | undefined,
@@ -742,10 +742,10 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
742742
hasMore: result.paging?.more ?? false,
743743
endingCursor: result.paging?.cursor,
744744
query: (limit: number | undefined) =>
745-
this.getLogForFile(repoPath, path, rev, { ...options, limit: limit }),
745+
this.getLogForPath(repoPath, path, rev, { ...options, limit: limit }),
746746
};
747747
if (log.hasMore) {
748-
log.more = this.getLogForFileMoreFn(log, path, rev, options);
748+
log.more = this.getLogForPathMoreFn(log, path, rev, options);
749749
}
750750

751751
return log;
@@ -769,7 +769,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
769769
}
770770
}
771771

772-
private getLogForFileMoreFn(
772+
private getLogForPathMoreFn(
773773
log: GitLog,
774774
relativePath: string,
775775
rev: string | undefined,
@@ -793,7 +793,7 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
793793
moreLimit = this.provider.getPagingLimit(moreLimit);
794794

795795
// const sha = Iterables.last(log.commits.values())?.ref;
796-
const moreLog = await this.getLogForFile(
796+
const moreLog = await this.getLogForPath(
797797
log.repoPath,
798798
relativePath,
799799
rev /* options.all ? undefined : moreUntil == null ? `${sha}^` : `${moreUntil}^..${sha}^ */,
@@ -830,15 +830,15 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
830830
// }
831831

832832
if (mergedLog.hasMore) {
833-
mergedLog.more = this.getLogForFileMoreFn(mergedLog, relativePath, rev, options);
833+
mergedLog.more = this.getLogForPathMoreFn(mergedLog, relativePath, rev, options);
834834
}
835835

836836
return mergedLog;
837837
};
838838
}
839839

840840
@log()
841-
getOldestUnpushedShaForFile(_repoPath: string, _uri: Uri): Promise<string | undefined> {
841+
getOldestUnpushedShaForPath(_repoPath: string, _pathOrUri: string | Uri): Promise<string | undefined> {
842842
// TODO@eamodio until we have access to the RemoteHub change store there isn't anything we can do here
843843
return Promise.resolve(undefined);
844844
}

src/views/nodes/commitFileNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export abstract class CommitFileNodeBase<
6969
if (commit == null) {
7070
const log = await this.view.container.git
7171
.commits(this.repoPath)
72-
.getLogForFile(this.file.path, this.commit.sha, { limit: 2 });
72+
.getLogForPath(this.file.path, this.commit.sha, { limit: 2 });
7373
if (log != null) {
7474
this.commit = log.commits.get(this.commit.sha) ?? this.commit;
7575
}

src/views/nodes/fileHistoryNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export class FileHistoryNode
253253
if (this._log == null) {
254254
this._log = await this.view.container.git
255255
.commits(this.uri.repoPath!)
256-
.getLogForFile(this.getPathOrGlob(), this.uri.sha, {
256+
.getLogForPath(this.getPathOrGlob(), this.uri.sha, {
257257
limit: this.limit ?? this.view.config.pageItemLimit,
258258
});
259259
}

0 commit comments

Comments
 (0)