You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e78eeab
Browse filesBrowse the repository at this point in the historyBrowse files
feat(git): workspace repository identities, selection and change groups in Core
A folder without its own .git that holds several independent repositories
is opened as one project (1lck/Lithe-IDEA#2013). The desktop decided in Go
which repository a view acts on, how the repositories' changes group and
stage, and whether a parent still has to record a nested commit, and it
assumed the opened folder is always a repository. Core now owns those rules
so every host shares them.
- workspace.repositories entries carry id (relative to the opened folder,
`/`-separated, `..` for an enclosing repository), name and role
(workspace or nested). A folder outside every repository has no workspace
entry. Remote workspaces compute IDs from host paths.
- git.workspaceRepositorySelection takes the discovery entries and the
previous pick, and answers the repository to act on, whether it fell
back, and the others in discovery order.
- git.workspaceChangeGroups takes the discovery entries with their
git.status changes, and answers per-repository groups, counts, the
checkbox states, the paths each checkbox stages or unstages, and whether
the deepest listed ancestor's gitlink to a nested repository moved. An
untracked or ignored independent repository gets no parent hint.
- git.workspaceCommitPrepare accepts workspaceRepositories and binds every
nested repository the host did not bind, except for path-scoped commits
and retries, so the reviewed plan never gains repositories between
attempts.
Fixtures: rust/fixtures/git/workspace-repository-selection-v1.json,
rust/fixtures/git/workspace-change-groups-v1.json, and the extended
rust/fixtures/workspace/repositories-v1.json.
Refs 1lck/Lithe-IDEA#2013
Copy file name to clipboardExpand all lines: rust/contracts/rust-core-api.md
+71Lines changed: 71 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -770,6 +770,8 @@ or removing a command fails until the table changes in the same commit.
770
770
|`git.historyLocate`| Append bounded history pages until one commit is found and report the budget, window cursor, and exhaustion |
771
771
|`git.branchNamePreview`| Clean and validate a new branch name against already loaded references without running Git |
772
772
|`git.repositoryColorAssignments`| Assign color slots to a bounded page of ordered repository identities |
773
+
|`git.workspaceRepositorySelection`| Choose the workspace repository a view acts on and the others it lists for switching, from discovery entries and the previous pick |
774
+
|`git.workspaceChangeGroups`| Group every workspace repository's status changes, plan each group's and the workspace line's staging, and report what a listed ancestor records for a submodule |
773
775
|`git.updatePlan`| Route a branch Update and gate a Pull from facts the host collected: blockers, strategy default, whether to ask, and the expected checkout |
774
776
|`git.historyWindow`| Plan a history refresh window, page merge, and selection retention over commit identities |
775
777
|`git.graphProjection`| Project a loaded history window into commit-graph lanes, color IDs, routes, print elements, and labels, optionally filtered |
@@ -898,6 +900,21 @@ embedded spaces and long paths are not rejected by length; native Git/filesystem
898
900
errors remain visible. In particular, Windows may reject an over-MAX_PATH Git
899
901
working directory at process creation even when filesystem lookup succeeds;
900
902
this is reported as `process_start_failed`, not a missing repository. Shared examples live in `rust/fixtures/git/windows-paths.json`.
903
+
Each entry also carries the portable identity clients key repositories by:
904
+
`id` is the root relative to the opened folder with `/` separators — `.` for the
905
+
folder itself, `service-a` or `libs/core` below it, and one `..` per level for an
906
+
enclosing repository (`../..` when the folder is `packages/app` of a checkout).
907
+
It is the ID that `git.workspaceRepositorySelection`, `git.workspaceChangeGroups`,
908
+
`git.workspaceCommitPrepare` and `git.repositoryColorAssignments` take; a remote
909
+
workspace computes it from host paths, so it is the same as for a local folder.
910
+
`role` is `workspace` for the repository that contains the opened folder (the
911
+
folder itself or an enclosing checkout), at most one entry and always first, and
912
+
`nested` for every repository below the folder. An opened folder outside every
913
+
repository — a parent folder that only holds independent checkouts — has no
914
+
`workspace` entry, and clients must not assume one exists. `name` is the label
915
+
views show: the root folder's name for the workspace repository and the `id` for
916
+
a nested one, so same-named folders in different places stay distinguishable. It
917
+
is a file name, never translated. See `rust/fixtures/workspace/repositories-v1.json`.
901
918
Core treats both
902
919
`.git` directories and `.git` files as repository markers, but a marker only
903
920
becomes a listed repository when Git can open it: a `.git` directory needs
@@ -1961,6 +1978,50 @@ Callers must keep pages from the same list generation together, cancel or discar
1961
1978
stale results, and never recompute the slots per row. Color palettes remain native
1962
1979
presentation. See `rust/fixtures/git/repository-colors-v1.json`.
1963
1980
1981
+
`git.workspaceRepositorySelection` is pure. It accepts `{ repositories,
1982
+
selected? }`, where `repositories` are the `workspace.repositories` entries
1983
+
`{ path, id, name, role }` passed back unchanged and in discovery order, and
1984
+
`selected` is the ID the view acted on before. The response is
1985
+
`{ active, fellBack, others }`: `active` is `selected` while it is still listed,
1986
+
otherwise the entry with role `workspace`, otherwise the first entry, and `null`
1987
+
for an empty list; `fellBack` is `true` only when `selected` was given and is no
1988
+
longer listed, so the view drops state that belonged to it such as an open
1989
+
history cursor or a reference filter; `others` are the remaining IDs in
1990
+
discovery order, the groups the branch popup and the Git Log list for switching.
1991
+
The list holds at most 10,000 entries. An ID that is empty, longer than 4,096
1992
+
bytes, starts with `/`, or contains `\` or NUL, an empty path or name, a repeated
1993
+
ID or path, more than one `workspace` role, an unknown role, an empty `selected`,
1994
+
or an unknown field fails with `invalid_request`. See
0 commit comments