Skip to content

Find Git Bash through git --exec-path in mirai.cmd and the tool alike - #11

Merged
tomaszbk merged 1 commit into
mainfrom
tools/git-bash-anywhere
Nov 15, 2026
Merged

tomaszbk merged 1 commit into
mainfrom
tools/git-bash-anywhere

Conversation

@5hif7y

@5hif7y 5hif7y commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Closes #8.

Rebuilt on main 8c5a2a6 after the review; the comment below answers it point by point.

Changes

Find Git Bash through git --exec-path in mirai.cmd and the tool alike

The tool looked only in %ProgramFiles%\Git, so bench compare and
mirai measure failed with Git installed elsewhere, and mirai.cmd probed
four folders before asking git. Both now take one rule: git --exec-path
names /mingw64/libexec/git-core, and Git Bash is /bin/bash.exe.
It also finds a Git reached through a shim, such as Scoop's.

Merge order

Independent: any order. All six PRs were merged together onto main with no conflict, and the steps of checks.yml pass on that tree (mirai check on 135 packages, 18 test suites without a GPU).

Not tested

  • Scoop for real (covered by the test only), Linux and macOS (the sh path is unchanged).

🤖 Generated with Claude Code

@5hif7y

5hif7y commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

Needs more testing as a user before merging.

The tests and the sessions listed in the description cover the engine side only. My lead and I will adapt it as needed, and tomorrow I will test it with a separate agent acting as a Mirai user.

@tomaszbk

Copy link
Copy Markdown
Member

Review: rework. The branch conflicts in tools/mirai/bench.odin, render.odin and shell_test.odin. Of the three fixes from #8, main has already solved one in another way. The other two are still open.

  1. Superseded: the build mode of the base. tools/mirai/bench.odin:220 hard-codes release=true for the base. main builds head and base the same way: dev by default, release only with --release (b6db65c). Ported as it is, a plain bench compare would compare a dev head with a release base.
  2. Still needed, but it won't port as written: the retry on unknown fields.
    • headless_call_known (tools/mirai/headless.odin:71) takes a json.Object, but headless_call on main now takes any.
    • On main, render_call still matches the old unknown field " text. The API no longer sends that text; it now says "x" is not a field.
    • bench_call has no retry at all.
    • So today, on main, a base that does not know a field still fails.
  3. A second copy of the Git search. git_bash_find (tools/mirai/shell.odin:25) repeats the search in mirai.cmd and already differs from it.
    • It looks next to the git.exe it finds on PATH, while mirai.cmd asks git --exec-path.
    • So it never finds a Git reached through a shim, such as Scoop's.
    • A single git --exec-path call could replace all the per-folder probing.
  4. Fragile error matching. The field name is read out of the human-readable error text (headless.odin:84). If that message is reworded, the retry silently stops working. The name should come from a structured field of the error.

The tool looked only in %ProgramFiles%\Git, so bench compare and
mirai measure failed with Git installed elsewhere, and mirai.cmd probed
four folders before asking git. Both now take one rule: git --exec-path
names <root>/mingw64/libexec/git-core, and Git Bash is <root>/bin/bash.exe.
It also finds a Git reached through a shim, such as Scoop's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@5hif7y
5hif7y force-pushed the tools/git-bash-anywhere branch from 0964548 to ab4a332 Compare November 15, 2026 01:24
@5hif7y 5hif7y changed the title Let bench compare build and measure its base on any Git install Find Git Bash through git --exec-path in mirai.cmd and the tool alike Nov 15, 2026
@5hif7y

5hif7y commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

Rebuilt on main 8c5a2a6 as one commit, ab4a332e, force-pushed to tools/git-bash-anywhere. It merges into main cleanly.

  1. The build mode of the base. Dropped. main already builds both sides alike (b6db65c).
  2. The retry on unknown fields. Dropped, because main now has it. ae45487 landed on 2026-11-11, after this branch was cut:
    • the API names the field in error.data.unknown_field (editor/api/shape.odin, tested in shape_test.odin);
    • bench (tools/mirai/bench.odin:288) and render (tools/mirai/render.odin:890) both go through headless_call, which retries without each field the error names;
    • the old text match in render_call is gone.
  3. A second copy of the Git search. Gone. mirai.cmd and shell_executable now share one rule: git --exec-path, then <exec>/../../../bin/bash.exe. All the per-folder probing is removed from both.
    • This finds a Git reached through a shim. The test git_bash_is_found_from_the_exec_path_of_git has a Program Files case and a Scoop case.
    • When git is not on PATH, the error says what to install.
  4. Fragile error matching. Dropped together with point 2: headless_call on main reads the structured field and parses no message text.

The PR is now only point 3. Code without tests is +18/−26.

Verification (Windows 10, Git in C:\Workbench\PKGMGR\gitforwindows, outside Program Files):

  • mirai test tools/mirai passes 80/80.
  • mirai measure of a #! script ran Git Bash 5.2.37.
  • mirai build editor demo succeeded.
  • mirai render check found Git Bash. It does not without this change.

Not tested: Scoop for real (covered by the test only), Linux and macOS (the sh path is unchanged).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mirai bench compare cannot measure against a base on some machines, and measures the wrong build when it can

2 participants