* Gets the diff between two commits and parses it to the list of changed files and their chunks.
(commit1: string, commit2: string)
| 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. |