git.status¶
git.status reports the changes in a linked git worktree of a session. If path is a linked worktree of the repository of baseRepo, the reply is the status. Every other request that does not fail gets "isRepo": false. The daemon runs git on a temporary copy of the git files of the worktree. So the status never rewrites the index and never takes index.lock.
An untagged rule on this page matches build 5fd08069 or an earlier build, measured on Linux, macOS and Windows.
Request¶
| Parameter | Required | Meaning |
|---|---|---|
path |
no | The linked worktree. Send an absolute path. Without path, the daemon looks for a registration of its own working directory (not measured). Send path. A relative path gives "isRepo": false or -32603 exit status 128. A . works like no path (from the code). Path handling has the rules for a leading ~. |
baseRepo |
yes | The repository that owns the worktree. With a linked worktree as baseRepo, the daemon goes on in the git directory of the main repository. That worktree as path gets the status, also with "shadowDirOff": true, and so does another linked worktree of the repository (be1c1ca5 and b3081b51, measured on Linux). macOS and Windows are claustrum's own, not measured. |
shadowDirOff |
no | true turns off the daemon's own read of the repository's git config and its settings copy for this request. Turning the read off. |
Response¶
| Member | Meaning |
|---|---|
isRepo |
If path is a linked worktree of the repository of baseRepo, true. |
clean |
If changes is empty, true. Else false. |
changes |
The entries of the status, in the order of The changes. If there is no entry, the member is absent. |
If the request does not name a linked worktree of the repository of baseRepo, the response is not an error. It has both members:
That holds for:
- a
paththat is the repository itself, a plain folder or a subfolder - a nested repository, a missing folder or a regular file
- a worktree of another repository, or a right worktree with the wrong
baseRepo - a linked worktree as
pathandbaseRepowith no git on PATH (4c111e86, measured), and the main repository aspathandbaseRepotoo (87375cc7, measured on Linux, other repositories, macOS and Windows claustrum's own). On Windows4c111e86keeps its failed start test, and87375cc7keeps none (rule). On Windows see the git in the working folder
How the daemon finds the worktree has the rules.
Errors¶
A failure is a JSON-RPC error with no errorCode member. It changes nothing in the repository or worktree.
Shared refusals¶
| Code | Text | Cause |
|---|---|---|
-32602 |
Invalid params |
No params member, or a member that it reads has the wrong type. the rules for params. |
-32602 |
baseRepo is required |
baseRepo is absent, or empty (from the code). |
-32603 |
the repository's git directory could not be trusted; git not run: … |
The daemon does not trust the git directory. Git-directory trust check. |
-32603 |
config-defined hooks could not be pinned off; git not run: … |
A config listing failed or passed a limit of the hook pins. Or the daemon refuses its own git environment, or a daemon GIT_DIR names a gone worktree entry. A listing stopped at 30 seconds has its own text in the error catalogue. Refusal texts and The daemon's own git environment. |
-32603 |
git cannot run on this host; git not run: … |
A config listing, a call of the start test or the call about the repository failed, and then git version failed too. the error catalogue. |
-32603 |
this repository's git config cannot be used: … or a file in this repository's .git directory cannot be used: … |
The daemon does not accept the git config or a git directory file. Repository config refusals. |
-32603 |
Claude could not test git on the remote machine (…). Check free disk space and quota there, then try again. |
The start test of the settings copy failed. The daemon keeps the failure for 10 seconds. The start test. |
-32603 |
git could not check this repository on the remote machine: … or git and Claude disagree about which repository holds this folder: … |
The call that asks git about the repository failed, ran over 30 seconds, or named another repository. The call about the repository. |
-32603 |
Claude could not prepare its own files on the remote machine: … |
The daemon cannot prepare the settings copy folder, or .probe. The folders. |
Git and copy failures¶
| Code | Text | Cause |
|---|---|---|
-32603 |
git took too long: Claude stopped git <subcommand> after 2 minutes; try again |
A git call ran 2 minutes, and the daemon stopped it. While a "shadowDirOff":true request runs, that one included, the limit is 30 minutes, and the text says so (claustrum's own). Time limits. |
-32603 |
The Go error of the git call, for example exit status 128 |
git status, git ls-files or git diff-index failed. The text of git does not show. A relative path that matches a registration gets exit status 128, because git takes it as sent. |
-32603 |
config-defined hooks could not be pinned off; git not run: listing the configuration in force: and the start error, for example chdir <path>: no such file or directory |
path passed the test as a cleaned path, but git cannot start in the path as sent. An example is <dir>/missing/.. outside baseRepo (measured on Linux and macOS). |
-32603 |
<file>: not a regular file (claustrum's own) |
From the copy into the temporary git folder after the gate passed. An info/sparse-checkout folder or FIFO gets it. |
-32603 |
<file> is larger than <n> bytes (claustrum's own) |
A copied file is over its bound, also one that grew after the gate. <n> is 1073741824 for index, a sharedindex.<40 or 64 hex> file, info/sparse-checkout and a reftable file, and 1048576 for HEAD and config.worktree. |
-32603 |
An error of the file system, for example openat index: permission denied or stat <dir>: no such file or directory |
The raw Go error. The daemon cannot copy a file of the registration or make a file of the temporary git folder. The reference is not measured there. |
Failed listings and temporary folders: Rare states.
How the daemon finds the worktree¶
The daemon does not ask git inside path. It reads the registrations of the repository. A registration is the folder <common>/worktrees/<name> that git keeps for each linked worktree. <common> is the git directory that git rev-parse --absolute-git-dir prints in baseRepo. For a linked worktree as baseRepo, it is the git directory of the main repository (be1c1ca5 and b3081b51, measured on Linux). claustrum takes that git directory from the trust check. If git prints a folder that is not the trusted entry, the answer is "isRepo": false (claustrum's own, not measured).
baseRepo¶
Each of these gives "isRepo": false before any git call:
baseRepohas the components.claude/worktreesin it, or is that folder.<dir>/.claudealone passes.- A folder above
baseRepoholds an entry named.claude-managed-worktreesand no.git. A marker insidebaseRepoitself does not count. A marker one or two levels above counts (measured on Linux). Further up the test is claustrum's own. baseRepodoes not resolve. For example, it is missing, or a..after a symbolic link goes up from the target of the link and finds no folder.
Then the git-directory trust check runs on baseRepo, not on path. A refusal answers -32603, also for a good linked worktree as path. If the check finds no repository, the answer is "isRepo": false, with exceptions. A config of baseRepo that the daemon does not accept answers -32603, as in Repository config refusals.
baseRepo can be a symbolic link to the repository, a bare repository, a submodule checkout or a subfolder. If git prints no git directory, or there is no worktrees folder, the answer is "isRepo": false.
path¶
Each of these gives "isRepo": false:
pathis not a folder, or it does not exist.pathlies insidebaseRepo, and a component belowbaseRepois a symbolic link. That includes a link at.claude, and a link at the last component (measured on Linux).pathlies insidebaseRepoand has a..component. A.component passes (measured on Linux). OutsidebaseRepoa..passes.- On Windows
pathcannot be opened, such as a folder with the reparse tagIO_REPARSE_TAG_WIM. The answer comes before the config listing andrev-parse --show-toplevelin the git directory (4c111e86, measured on Windows for that tag). Other open failures and the place of the test are claustrum's own, not measured.
The .git file inside path plays no part. If it is missing, damaged or names another place, the answer is still the status. So is a locked worktree.
The registration match¶
Exactly one registration must name path. Two that match give "isRepo": false, and so does none. A relative gitdir or commondir value counts from the registration folder.
- A registration is a real folder. A symbolic link under
worktreesdoes not count. - Its
gitdirfile must be a regular file of at most 1 MiB. The last component of its value must be.git. - The folder before
.gitmust equalpathas text. Two spellings ofpathmatch: as sent, and with its symbolic links resolved. For apathinsidebaseRepo, the second spelling is the resolvedbaseRepo. The rest ofpathfollows as sent (claustrum's own) (not measured below a symbolic link).
The matched registration must pass these tests. Each failure gives "isRepo": false.
commondirmust be a regular file, or a relative symbolic link to a file in the registration folder. Its value must equal<common>as text, in the spelling that git printed.HEADmust hold 40 or 64 hex characters, or aref:line underrefs/(measured on Linux). A branch that does not exist and a detached commit pass.indexmust be a regular file of at most 1 GiB, or be missing (measured on Linux and Windows). A symbolic link to a regular file in the registration folder passes too (measured on Linux). Asharedindex.<hex>file that is a regular file has the same 1 GiB bound. Theindexand allsharedindex.*files together must hold at most 2 GiB (measured on Linux).config.worktreecan be missing. If it exists, it must parse and hold onlycore.sparseCheckout,core.sparseCheckoutConeandindex.sparse.user.namegives"isRepo": false. So doescore.bare, andcore.sparseCheckoutConepasses (measured on Linux). claustrum refuses every other key too (not measured).
What the status reads¶
The daemon makes a temporary git folder in its own folder under git-shadow. With "shadowDirOff":true, or with no run folder, it is in the temporary directory of the system. It holds copies of HEAD, index, config.worktree, info/sparse-checkout, the sharedindex.* files with hex names and the reftable files of the registration. It also holds a commondir file. The daemon removes the folder before it replies.
The daemon runs four git commands in path. The git directory is that folder, and the work tree is path as sent:
status --porcelain --untracked-files=all --ignore-submodules=all
ls-files -s -z
rev-parse --verify -q HEAD^{commit}
diff-index --cached --raw -z --ignore-submodules=none HEAD --
If HEAD names no commit, diff-index compares with the empty tree.
- The calls ignore the
.gitattributesfiles, so no clean filter runs, but before git 2.40 the attributes apply. - The calls read no replace objects from
refs/replace. - In the state
shadowthestatuscall carries-c lfs.storage=<temporary git folder>/lfs(b3081b51, measured on Linux, macOS and Windows). The other calls carry none (measured on Linux and macOS). It follows--work-tree(4c111e86, measured on Linux and Windows, macOS claustrum's own), also where the user config setslfs.storage(claustrum's own, not measured). status,ls-filesanddiff-indexcarryGIT_OPTIONAL_LOCKS=0. All calls run as hardened git calls.- If the user has a global excludes file, the status uses it.
The changes¶
changes holds three groups, in this order.
- The lines of
git status --porcelain, verbatim, minus the line end. Warnings on stderr never appear. The XY column is positional, so the leading space of an unstaged change is data:"M a.txt"is staged and" M b.txt"is unstaged. An untracked file in an untracked folder has its own entry, as"?? sub/u.txt". - One entry for each gitlink in the index, unless
<name>/.gitdoes not exist (measured on Linux). A gitlink is an index entry of mode160000. There is one entry for each index stage, so a gitlink in conflict gives three (measured on Linux). - One entry for each staged change whose old or new mode is
160000(measured on Linux).
One gitlink can have entries in all three groups (measured on Linux).
Submodule entries and limits¶
A submodule entry is S, the quoted name and one of three texts (measured on Linux):
| Text | Meaning |
|---|---|
(submodule present; contents not inspected) |
<name>/.git exists, as a file, a folder or a dangling symbolic link. A gitlink path that is a symbolic link to a folder inside the work tree counts as present (measured on Linux). |
(submodule; could not be inspected) |
The daemon cannot look at <name>/.git (measured on Linux). Examples are a gitlink path that is a regular file, a symbolic link out of the work tree, or a folder of mode 000 (measured on Linux). |
(submodule change staged; contents not inspected) |
A staged change of a gitlink (measured on Linux). |
- A porcelain line over 512 bytes is cut to 512 bytes, and
…follows (measured on Linux). At most 10000 porcelain lines pass, and no entry marks the cut (measured on Linux). The submodule entries still follow (measured on Linux). - A submodule name over 200 bytes is cut to 200 bytes, and
…follows (measured on Linux). The name is then quoted with double quotes,\",\n,\t, and\xfffor a byte that is not valid UTF-8 (measured on Linux). A printable character outside ASCII stays (measured on Linux). - At most 100 submodule entries pass (measured on Linux). Then one entry counts the rest, for example
S … (+20 more submodule entries)(measured on Linux).
Differences by system¶
- With no user excludes file, the status runs.
- The junction rules of Windows do not apply.
- A
baseRepowhere git cannot start, such as a file, gives"isRepo": false. - A repository file gets the repository call,
-32603and the settings copy, also after a 15 s hold. A file link counts in the folder of its target: a target in any repository gets its gate, and a target in none gets no gate. Both give"isRepo": falsewhen the gate passes. A refused config there is not measured.4c111e86is measured on Linux, and macOS is claustrum's own. - A last
pathcomponent insidebaseRepothat ends in a dot or space, or holds a colon, is not special. - Letter case in the registration match is exact.
pathmatches only as sent and as resolved.- A gitlink path that is a regular file gives
(submodule; could not be inspected)(measured on Linux).
- Another letter case, the NFD form and
/System/Volumes/Datado not match in the registration match. - A
commondirvalue under/tmpfails, because git prints/private/tmp.
- With no global excludes file of the user, the
statuscall passes-c core.excludesFile=NUL. Git 2.55.0.windows.3 refuses it, and the reply is-32603 "exit status 128"(c9125eb8and4c111e86, measured on Windows). - A
baseRepowith a junction before its last component gives the status (4c111e86, measured on Windows). A dangling junction gives"isRepo": falseafter the read of the user's excludes (measured on Windows). A..drops the name before it first, whatever it is: a missing name, a file, a junction, or a live, dangling or looping link. So<S>\missing\..\P\repoand<S>\P\..\P\repo, wherePis a junction, make the git calls of<S>\P\repo(4c111e86, measured on Windows). A dangling symbolic link as the last name gives"isRepo": falseat once (claustrum's own, not measured). A link to a network or device path is refused first (network links). - A
baseRepothat exists and in which git cannot start, such as a regular file, gives-32603with the start error of the listing. See Git-directory trust check. - A junction below
baseRepoinpathgives"isRepo": false, as a symbolic link does. - A last component of a
pathinsidebaseRepothat ends in a dot or a space, or holds a colon, gives"isRepo": false. claustrum refuses such a name at any component (not measured). OutsidebaseRepoa trailing dot or space passes. - The folder compare of the registration match ignores letter case. A
gitdirvalue that ends in.GITfails. - A junction
pathoutsidebaseRepogets onerev-parse --show-toplevel. Its--work-treeis the real path, not the junction spelling (4c111e86, measured on Windows). - A subst drive, a junction, a
\\?\path and 8.3 short names matchpathtoo. Apathwith short names inside abaseRepoin short names finds no registration. - A
commondirvalue with forward or back slashes passes. Another letter case, a short name, a\\?\prefix and a value with no drive letter fail. - A
baseRepothat is a junction to the repository gives the status. The daemon goes on with the git directory that git prints. - A gitlink path that is a regular file gives no entry. A junction there gives
(submodule; could not be inspected). - An alternates file of a fault,
GIT_ALTERNATE_OBJECT_DIRECTORIESand abaseRepothrough 32 or more links give-32603, and only the excludes read runs git. With"shadowDirOff":truetheGIT_ALTERNATE_OBJECT_DIRECTORIEStest does not run (4c111e86). Object sources. - A
baseRepothrough a link to a network or device path gives-32603, and no git call runs on it. Network links. - A
\\?\UNC\baseRepoor a refused share gives-32603. UNC refusals. - A
.gitwithIO_REPARSE_TAG_PROJFSis no link, and abaseRepobelow anIO_REPARSE_TAG_WIMfolder gives-32603(4c111e86). Reparse tags.
Rare states¶
A check that finds no repository
A config listing that fails gives the hooks refusal. If git version fails too, it gives the "cannot run" text of Hardened git calls.
A .git file can name a gone git directory that is no registration. The answer is "isRepo": false, with and without "shadowDirOff":true (git 2.56.1, 4c111e86, measured on Linux, macOS and Windows). An older git gives it without the member (4c111e86, measured on Linux).
A failed config listing
The first config listing refuses by these classes. Later listings refuse any failure, in the git directory (measured on Linux) and in the temporary folder (from the code). Over a hook-pin limit the first listing refuses in a repository (from the code), and later ones do not (from the code). The empty-tree listing never refuses (from the code). A stopped listing of config.worktree gives {"isRepo":false,"clean":false} (measured on Linux).
No temporary git folder
If the daemon cannot make its folder under git-shadow, the response is {"isRepo":false,"clean":false} (measured on Linux and Windows). When the folder is in the temporary directory of the system, a failure answers -32603 with the error of the file system (not measured).
Reftable and FIFO files
A repository can have the reftable format. If the reftable folder then holds a tables.list file, it must name at least one table (measured on macOS). Each table must be a regular file (measured on macOS). If reftable is not a real folder, or tables.list is a FIFO, the request goes on (measured on macOS). git then shows every tracked file as added (measured on macOS).
No test waits on a FIFO (measured on Linux and macOS). A FIFO in place of gitdir, commondir or config.worktree fails at once (measured on Linux and macOS). A FIFO at index fails at once too (measured on Linux), and so does one at HEAD (from the code).
A cut inside a multi-byte character
A cut can split a multi-byte character (claustrum's own) (not measured). In a porcelain line, the JSON encoding then sends U+FFFD for each leftover byte (claustrum's own) (not measured). In a submodule name, the quoting writes each leftover byte as \xNN (claustrum's own) (not measured).
Differences from the reference¶
A rule that names a system is measured there only. A linked rule keeps the marks of its own section.
No entry of the divergence catalog applies to this method.
The measured cells behind each rule are in the tests and in the reference build history.