Show recent commit history in the explorer (#2312)
* feat(app): show recent commit history in explorer * fix(app): keep recent commit history accurate * fix(app): include merged commits in recent history * perf(app): bound recent commit classification * fix(app): refresh recent commits on Git updates
This commit is contained in:
@@ -88,4 +88,22 @@ describe("getCommitFileDiff", () => {
|
||||
|
||||
expect(file).toBeNull();
|
||||
});
|
||||
|
||||
it("returns a merge commit diff against its first parent", async () => {
|
||||
const repoDir = initRepo();
|
||||
commitFile(repoDir, "README.md", "base\n", "initial");
|
||||
git(["checkout", "-b", "feature"], repoDir);
|
||||
commitFile(repoDir, "feature.txt", "feature\n", "add feature");
|
||||
git(["checkout", "main"], repoDir);
|
||||
commitFile(repoDir, "main.txt", "main\n", "advance main");
|
||||
git(["merge", "--no-ff", "feature", "-m", "merge feature"], repoDir);
|
||||
const sha = headSha(repoDir);
|
||||
|
||||
const file = await getCommitFileDiff({ cwd: repoDir, sha, path: "feature.txt" });
|
||||
|
||||
expect(file?.path).toBe("feature.txt");
|
||||
expect(file?.isNew).toBe(true);
|
||||
expect(file?.additions).toBe(1);
|
||||
expect(file?.deletions).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user