MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / git_program

Function git_program

src/git.rs:34–37  ·  view source on GitHub ↗

Returns the resolved `git` program to spawn, as a cached `&'static OsStr`. Resolution order (performed once, then cached): 1. The `GIT` environment variable, if set and non-empty (explicit override, matching git's own habit of honoring a program override). 2. An absolute path found by a which-style walk of `PATH` (+ `PATHEXT` on Windows). 3. The literal `"git"` fallback, so behavior is never wors

()

Source from the content-addressed store, hash-verified

32/// Callers pass the result straight to `Command::new(..)` (both `std` and
33/// `tokio` accept `impl AsRef<OsStr>`).
34pub fn git_program() -> &'static OsStr {
35 static PROGRAM: OnceLock<OsString> = OnceLock::new();
36 PROGRAM.get_or_init(resolve_git_program).as_os_str()
37}
38
39fn resolve_git_program() -> OsString {
40 // 1. Explicit override wins. Empty values are ignored so an accidental

Callers 6

is_ignored_by_gitFunction · 0.70
local_branch_existsFunction · 0.70
current_branch_gitFunction · 0.70
git_rev_list_countFunction · 0.70
git_commandFunction · 0.70

Calls

no outgoing calls

Tested by 1