Fix remote-only git status fallback state
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
6840b709ad
commit
fc50e65e55
2 files changed
+29
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import type { GitStatusRemoteResult } from "@t3tools/contracts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { applyGitStatusStreamEvent } from "./git";
|
||||
|
||||
describe("applyGitStatusStreamEvent", () => {
|
||||
it("treats a remote-only update as a repository when local state is missing", () => {
|
||||
const remote: GitStatusRemoteResult = {
|
||||
hasUpstream: true,
|
||||
aheadCount: 2,
|
||||
behindCount: 1,
|
||||
pr: null,
|
||||
};
|
||||
|
||||
expect(applyGitStatusStreamEvent(null, { _tag: "remoteUpdated", remote })).toEqual({
|
||||
isRepo: true,
|
||||
hasOriginRemote: false,
|
||||
isDefaultBranch: false,
|
||||
branch: null,
|
||||
hasWorkingTreeChanges: false,
|
||||
workingTree: { files: [], insertions: 0, deletions: 0 },
|
||||
hasUpstream: true,
|
||||
aheadCount: 2,
|
||||
behindCount: 1,
|
||||
pr: null,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -231,7 +231,7 @@ export function applyGitStatusStreamEvent(
|
||||
if (current === null) {
|
||||
return mergeGitStatusParts(
|
||||
{
|
||||
isRepo: false,
|
||||
isRepo: true,
|
||||
hasOriginRemote: false,
|
||||
isDefaultBranch: false,
|
||||
branch: null,
|
||||
|
||||
Reference in new issue
Block a user