fix(git): the branch switcher lists and checks out branches only the remote has
GET /api/lanes/:id/git/branches read only refs/heads, so a branch someone else pushed never showed after a fetch or pull, and `switch` refused it (ENOBRANCH). It now also returns `remotes`: fetched remote-tracking branches with no local branch of that name (origin/HEAD left out), listed under "On the remote"; switching to one runs `git switch -c <b> --track refs/remotes/<remote>/<b>` with the remote ref looked up, never passed through (bare name only when exactly one remote has it, else EAMBIGUOUS). The bar also re-reads the branch list after a fetch or pull instead of keeping the list it loaded first.
This commit is contained in:
@@ -1122,6 +1122,7 @@ describe("the lane git surface: changes, branches, actions (issue #34)", () => {
|
||||
const r = await request("GET", `/api/lanes/${laneId}/git/branches`);
|
||||
assert.equal(r.status, 200);
|
||||
assert.deepEqual(r.body.branches, ["feat/api-changes"]);
|
||||
assert.deepEqual(r.body.remotes, []); // no remote at all
|
||||
assert.equal(r.body.current, "feat/api-changes");
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user