MCPcopy
hub / github.com/expo/expo / getDiffAsync

Method getDiffAsync

tools/src/Git.ts:433–445  ·  view source on GitHub ↗

* Gets the diff between two commits and parses it to the list of changed files and their chunks.

(commit1: string, commit2: string)

Source from the content-addressed store, hash-verified

431 * Gets the diff between two commits and parses it to the list of changed files and their chunks.
432 */
433 async getDiffAsync(commit1: string, commit2: string): Promise<GitFileDiff[]> {
434 const { stdout } = await this.runAsync(['diff', `${commit1}..${commit2}`]);
435 const diff = parseDiff(stdout);
436
437 return diff.map((entry) => {
438 const finalPath = entry.deleted ? entry.from : entry.to;
439
440 return {
441 ...entry,
442 path: join(this.path, finalPath!),
443 };
444 });
445 }
446
447 /**
448 * Lists the contents of a given tree object, like what "ls -a" does in the current working directory.

Callers

nothing calls this directly

Calls 3

runAsyncMethod · 0.95
joinFunction · 0.90
mapMethod · 0.80

Tested by

no test coverage detected