Expand description
The real Git that the commit service’s unit file records, read as the fallback when PATH offers none.
What:
Read the real Git that the wrapper’s commit service was set up with,
from the unit file the wrapper wrote for it.
Why:
Nothing the wrapper installs records the real Git it shadows.
The one file that names a real Git is the unit of the
commit service (service_provision.rs):
its ExecStart line holds --git <path>,
the Git the wrapper resolved
when it last provisioned the service.
When no real Git follows the wrapper on PATH,
that path is the only
recorded one,
so the resolver (real_git.rs) falls back to it,
after the same checks a PATH candidate passes.
This is the coordinator’s pick under the owner’s delegation,
open to the owner’s veto
(doc/planning/cli-git-no-self-invocation.md,
section “Falling back to the Git the commit service was set up
with”).
The file lives in the runtime directory,
so it is gone after the account’s last logout,
and no record then
means no fallback.
In TS you’d write (pseudocode):
const unitText = readFileSync(join(runtimeDir, 'systemd/user/cli-git@.service'), 'utf8');
const recordedGit = unitText.match(/^ExecStart=.*\s--git\s+(\S+)/m)?.[1]; // undefined: no recordFunctions§
- read_
recorded_ git - What: The Git a unit file records, read with the bound a launcher record is read with. Why: The unit is a few hundred bytes, so a file past the bound is not the wrapper’s unit and names nothing. An unreadable or missing file names nothing either, and the caller keeps its stop.
- recorded_
git_ path - What:
The absolute path after
--giton theExecStartline of a unit’s text.Option<PathBuf>is the path or nothing (PathBuf | undefined). Why: The wrapper writes the path unquoted, so whitespace cuts the line into words and the word after--gitis the path. A relative path is no record, because it would mean a different file for each directory the wrapper runs in. A path with a space in it is cut short and then fails the checks of the resolver, which is the safe outcome. - service_
unit_ file - What:
The unit file of the commit service below a runtime directory.
&Pathborrows a path (sibling:PathBufowns one), andPathBufis returned because the result is built here. Why: The wrapper writes the service unit there, and nowhere else is searched: a record found by looking through other places would be a guess.