Skip to content

Commit 7135c33

Browse files
committed
Shows one-branch diff for a PR creation by using '...' notation in diff
(vscode-gitlens-private#43, #4177)
1 parent 3f756ed commit 7135c33

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ export class DiffGitSubProvider implements GitDiffSubProvider {
8989
repoPath: string,
9090
to: string,
9191
from?: string,
92-
options?: { context?: number; includeUntracked: boolean; uris?: Uri[] },
92+
options?: { context?: number; includeUntracked: boolean; uris?: Uri[]; notation?: '..' | '...' },
9393
): Promise<GitDiff | undefined> {
9494
const scope = getLogScope();
9595
const args = [`-U${options?.context ?? 3}`];
9696

97-
from = prepareToFromDiffArgs(to, from, args);
97+
from = prepareToFromDiffArgs(to, from, args, options?.notation);
9898

9999
let paths: Set<string> | undefined;
100100
let untrackedPaths: string[] | undefined;
@@ -630,7 +630,7 @@ export class DiffGitSubProvider implements GitDiffSubProvider {
630630
}
631631
}
632632
}
633-
function prepareToFromDiffArgs(to: string, from: string | undefined, args: string[]) {
633+
function prepareToFromDiffArgs(to: string, from: string | undefined, args: string[], notation?: '..' | '...'): string {
634634
if (to === uncommitted) {
635635
if (from != null) {
636636
args.push(from);
@@ -656,6 +656,8 @@ function prepareToFromDiffArgs(to: string, from: string | undefined, args: strin
656656
}
657657
} else if (to === '') {
658658
args.push(from);
659+
} else if (notation != null) {
660+
args.push(`${from}${notation}${to}`);
659661
} else {
660662
args.push(from, to);
661663
}

src/git/gitProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ export interface GitDiffSubProvider {
363363
repoPath: string | Uri,
364364
to: string,
365365
from?: string,
366-
options?: { context?: number; includeUntracked?: boolean; uris?: Uri[] },
366+
options?: { context?: number; includeUntracked?: boolean; uris?: Uri[]; notation?: '..' | '...' },
367367
): Promise<GitDiff | undefined>;
368368
getDiffFiles?(repoPath: string | Uri, contents: string): Promise<GitDiffFiles | undefined>;
369369
getDiffStatus(

src/plus/ai/aiProviderService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ export class AIProviderService implements Disposable {
530530
progress?: ProgressOptions;
531531
},
532532
): Promise<AISummarizeResult | undefined> {
533-
const diff = await repo.git.diff().getDiff?.(compareRef, baseRef);
533+
const diff = await repo.git.diff().getDiff?.(compareRef, baseRef, { notation: '...' });
534534

535535
const log = await this.container.git.commits(repo.path).getLog(`${baseRef}..${compareRef}`);
536536
const commits: [string, number][] = [];

0 commit comments

Comments
 (0)