244
return await this._reportIfTreeUnchanged(telemetryContext, isContextCurrent, telemetryMessageId, location, repoInfo, workingDirectory, tree, 'success', safety.workspaceFileCount, fileDiffs.length, 0, fileRelativePaths);
245
}
247
>
const limiter = new Limiter<{ readonly uri: string; readonly originalUri: string; readonly renameUri: string | undefined; readonly status: string; readonly diff: string }>(DIFF_PATCH_CONCURRENCY);
248
>
const diffs = await Promise.all(resolvedDescriptors.map(descriptor => limiter.queue(async () => {
249
>
const paths = [descriptor.oldPath, descriptor.newPath].filter((path): path is string => path !== undefined);
250
>
const result = await this._gitService.getDiffPatchBetweenRefs(workingDirectory, { fromRef: headCommitHash, toRef: tree, paths, maxBuffer: MAX_DIFFS_JSON_BYTES });
251
>
if (!result) {
252
throw new Error(`Failed to compute diff for ${paths.join(', ')}`);
253
}
255
patchTooLarge = true;
256
}
258
>
uri: descriptor.uri,
259
>
originalUri: descriptor.originalUri,
260
>
renameUri: descriptor.renameUri,
261
>
status: descriptor.status,
262
>
diff: truncateRepoInfoDiff(result.patch ?? '', descriptor.uri),
263
>
};
264
>
})));
265
>
if (patchTooLarge) {
266
return await this._reportIfTreeUnchanged(telemetryContext, isContextCurrent, telemetryMessageId, location, repoInfo, workingDirectory, tree, 'diffTooLarge', safety.workspaceFileCount, fileDiffs.length, MAX_DIFFS_JSON_BYTES + 1, fileRelativePaths);
267
}
269
>
const measurement = measureRepoInfoDiffsJSON(diffsJSON);
270
>
if (measurement.tooLarge) {
271
return await this._reportIfTreeUnchanged(telemetryContext, isContextCurrent, telemetryMessageId, location, repoInfo, workingDirectory, tree, 'diffTooLarge', safety.workspaceFileCount, fileDiffs.length, measurement.diffSizeBytes, fileRelativePaths);
272
}
273
>
return await this._reportIfTreeUnchanged(telemetryContext, isContextCurrent, telemetryMessageId, location, repoInfo, workingDirectory, tree, 'success', safety.workspaceFileCount, fileDiffs.length, measurement.diffSizeBytes, fileRelativePaths, diffsJSON);
agentHostRepoInfoTelemetry.ts
274
}
275