110
return undefined;
111
}
113
>
const behind = await this._revListCount(operationId, repoPath, 'HEAD', '@{u}');
114
>
const ahead = await this._revListCount(operationId, repoPath, '@{u}', 'HEAD');
115
if (ahead === undefined || behind === undefined || ahead <= 0 || behind <= 0) {
116
return undefined;
117
}
119
>
return upstream;
120
}
121
122
private async _revListCount(operationId: string, repoPath: string, fromRef: string, toRef: string): Promise<number | undefined> {
123
>
const result = await this._exec(operationId, ['rev-list', '--count', `${fromRef}..${toRef}`], repoPath);
localGitService.ts
124
>
const parsed = Number(result.trim());
125
>
if (!Number.isFinite(parsed)) {
126
this._logService.warn(`[LocalGitService] Failed to parse rev-list count for ${fromRef}..${toRef} in ${repoPath}: ${result}`);
127
return undefined;
128
}
130
>
return parsed;
131
>
}
132
133
async checkout(operationId: string, repoPath: string, treeish: string, detached?: boolean): Promise<void> {