Skip to content

Commit 7a6b09c

Browse files
committed
Renames more sha to ref
1 parent fbb1328 commit 7a6b09c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/gitService.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -301,37 +301,37 @@ export class GitService extends Disposable {
301301
this._onDidChangeRepositories.fire();
302302
}
303303

304-
checkoutFile(uri: GitUri, sha?: string) {
305-
sha = sha || uri.sha;
306-
Logger.log(`checkoutFile('${uri.repoPath}', '${uri.fsPath}', '${sha}')`);
304+
checkoutFile(uri: GitUri, ref?: string) {
305+
ref = ref || uri.sha;
306+
Logger.log(`checkoutFile('${uri.repoPath}', '${uri.fsPath}', '${ref}')`);
307307

308-
return Git.checkout(uri.repoPath!, uri.fsPath, sha!);
308+
return Git.checkout(uri.repoPath!, uri.fsPath, ref!);
309309
}
310310

311311
private async fileExists(repoPath: string, fileName: string): Promise<boolean> {
312312
return await new Promise<boolean>((resolve, reject) => fs.exists(path.resolve(repoPath, fileName), resolve));
313313
}
314314

315-
async findNextCommit(repoPath: string, fileName: string, sha?: string): Promise<GitLogCommit | undefined> {
316-
let log = await this.getLogForFile(repoPath, fileName, { maxCount: 1, ref: sha, reverse: true });
315+
async findNextCommit(repoPath: string, fileName: string, ref?: string): Promise<GitLogCommit | undefined> {
316+
let log = await this.getLogForFile(repoPath, fileName, { maxCount: 1, ref: ref, reverse: true });
317317
let commit = log && Iterables.first(log.commits.values());
318318
if (commit) return commit;
319319

320-
const nextFileName = await this.findNextFileName(repoPath, fileName, sha);
320+
const nextFileName = await this.findNextFileName(repoPath, fileName, ref);
321321
if (nextFileName) {
322-
log = await this.getLogForFile(repoPath, nextFileName, { maxCount: 1, ref: sha, reverse: true });
322+
log = await this.getLogForFile(repoPath, nextFileName, { maxCount: 1, ref: ref, reverse: true });
323323
commit = log && Iterables.first(log.commits.values());
324324
}
325325

326326
return commit;
327327
}
328328

329-
async findNextFileName(repoPath: string | undefined, fileName: string, sha?: string): Promise<string | undefined> {
329+
async findNextFileName(repoPath: string | undefined, fileName: string, ref?: string): Promise<string | undefined> {
330330
[fileName, repoPath] = Git.splitPath(fileName, repoPath);
331331

332332
return (await this.fileExists(repoPath, fileName))
333333
? fileName
334-
: await this.findNextFileNameCore(repoPath, fileName, sha);
334+
: await this.findNextFileNameCore(repoPath, fileName, ref);
335335
}
336336

337337
private async findNextFileNameCore(repoPath: string, fileName: string, sha?: string): Promise<string | undefined> {
@@ -1301,17 +1301,17 @@ export class GitService extends Disposable {
13011301
return tracked;
13021302
}
13031303

1304-
private async isTrackedCore(repoPath: string, fileName: string, sha?: string) {
1305-
if (sha === GitService.deletedSha) return false;
1304+
private async isTrackedCore(repoPath: string, fileName: string, ref?: string) {
1305+
if (ref === GitService.deletedSha) return false;
13061306

13071307
try {
13081308
// Even if we have a sha, check first to see if the file exists (that way the cache will be better reused)
13091309
let tracked = !!await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName);
1310-
if (!tracked && sha !== undefined) {
1311-
tracked = !!await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, { ref: sha });
1310+
if (!tracked && ref !== undefined) {
1311+
tracked = !!await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, { ref: ref });
13121312
// If we still haven't found this file, make sure it wasn't deleted in that sha (i.e. check the previous)
13131313
if (!tracked) {
1314-
tracked = !!await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, { ref: `${sha}^` });
1314+
tracked = !!await Git.ls_files(repoPath === undefined ? '' : repoPath, fileName, { ref: `${ref}^` });
13151315
}
13161316
}
13171317
return tracked;

0 commit comments

Comments
 (0)