Skip to content

v2.55.0.5: static git + system_prefix self-locate (wpm flat layout) - #9

Merged
caomengxuan666 merged 4 commits into
masterfrom
feat/static-git-relocate
Oct 16, 2026
Merged

caomengxuan666 merged 4 commits into
masterfrom
feat/static-git-relocate

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Phase 2 of #8 follow-up: make usr/bin/git.exe the real git binary directly, no winuxcmd/launcher hops.

What

  • patch 0003 — system_prefix() validates its strip result against <prefix>/<GIT_EXEC_PATH>; on failure probes upward for the payload markers (opt/niugit/mingw64, mingw64) before falling back to the original chain. Normal MinGit/build layouts stay byte-identical (one extra is_directory stat); the probe only fires for the wpm flat layout.
  • static zlib/iconv — x64-windows-static-md searched first (ZLIB_USE_STATIC_LIBS=ON), git.exe's import table drops zlib1.dll/iconv-2.dll; curl/EXPAT stay dynamic in libexec/git-core where libcurl lives.
  • dashed server forms — git-{upload-pack,receive-pack,upload-archive}.exe hardlinked into mingw64/libexec/git-core (setup_path prepends exec-path to spawned PATH); dropped from bin/ (~15 MB exploded-zip savings, unreachable there).
  • dispatcher retired — root entry launcher no longer shipped; build_entry()/--entry-only kept for the differential suite.
  • package — wpm/niugit.json v2.55.0.5, layout: flat; mingw64/bin/git.exe → shared usr/bin/git.exe.

Perf

git --version 72-83 ms → 23.3 ms avg / 17.5 ms min; git status 19.9 ms avg (flat-layout simulation).

Verification

  • Upstream suite via real Git Bash (D:\Git): curated subset 2861 ok / 14 upstream TODO / 0 hard failures; transport batch (fetch-pack, fetch-push, clone, clone-local, protocol-v1, pull) 756 ok / 0 notok.
  • Harness fixes: perl shim auto-detects MSYS perl; test.sh wildcard globs work (were silently selecting nothing).
  • Manual: dist layout + flat simulation — init/commit/local clone (dashed helpers)/https clone/--system --list/templates all pass; dumpbin shows no zlib/iconv DLL imports.
  • Migration for installed users: wpm install niugit --force.

Release

Asset: niu-git-2.55.0.windows.2-x64.zip (33 147 311 B, sha256 dd852695…a379932) — note: v2.55.0.4 shipped as niugit-…zip, its index URL 404s; this fixes fresh installs.

Phase 2 of #8: make usr/bin/git.exe the real git.

- patch 0003: system_prefix() validates its strip result against
  <prefix>/<GIT_EXEC_PATH> and, when that fails, probes upward for the
  payload markers (opt/niugit/mingw64, mingw64) before falling back to
  the original chain. Strip-first keeps normal MinGit/build layouts
  byte-identical (one extra is_directory stat); the probe only runs for
  the wpm flat layout where the exe sits at <root>/usr/bin.
- build.py: link ZLIB (zs.lib) and Iconv (iconv.lib) from
  x64-windows-static-md (searched first, /MD in both triplets) so
  git.exe's import table drops zlib1.dll/iconv-2.dll; curl/EXPAT stay
  dynamic from x64-windows. -UZLIB*/-UIconv* so reconfigures re-resolve.
- build.py: hardlink the dashed server forms into
  mingw64/libexec/git-core (setup_path puts exec-path on PATH of spawned
  commands, so local clone/push finds them there), and stop shipping the
  root entry launcher - the flat layout maps mingw64/bin/git.exe straight
  to usr/bin/git.exe, no dispatcher hop.
- build.py: apply patches with git apply first (winuxcmd patch(1) 1.1.8
  drops -p1 stripping), reverse-check for idempotent re-runs.
- t-perl-shim: prefer Strawberry if present, else exec an MSYS
  /usr/bin/perl verbatim (present under a real Git Bash root); PATHEXP
  wrappers consume GITPERLLIB themselves so MSYS perl needs no
  conversion. Without this every test dies in chainlint when Strawberry
  is missing.
- test.sh: hold noglob while splitting $GLOB. The curated
  test-globs.txt bare names worked, but a documented wildcard arg
  (test.sh t0*) expanded against src/t cwd, appended .sh to an
  already-suffixed name, selected nothing, and reported the silent
  ok=0 notok=0.
libexec/git-core/git-{upload-pack,receive-pack,upload-archive}.exe are
what git actually runs: setup_path prepends exec-path to the PATH of
spawned commands, and that is also what the wpm flat layout resolves
through (usr/bin carries only git.exe). The bin/ copies were only ever
reached through the removed launcher's private PATH prepend, but they are
hardlinks of the 5 MB git.exe and a zip explodes hardlinks - ~15 MB of
artifact for no reachable code path.
wpm/niugit.json becomes the first layout:flat entry: mingw64/ and etc/
land under opt/niugit/ and mingw64/bin/git.exe maps to the shared
usr/bin/git.exe - the bare binary self-locates via patch 0003, no shim.
sha256/size match niu-git-2.55.0.windows.2-x64.zip (static zlib/iconv,
bin/ dashed forms dropped: 33 MB, was 21 MB).

README: bundle numbers, patch #3, dispatcher retirement, test-harness
notes (real Git Bash, perl auto-detect, wildcard globs), and the
v2.55.0.4 asset-name 404 warning.
@caomengxuan666
caomengxuan666 merged commit a7cbdae into master Oct 16, 2026
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.

1 participant