Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / assets / solaris-11.svg
Author[]google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.c...> 2025-08-18 06:09 UTC
Committer[]Andy Green <andy@warmcat.com> 2025-08-18 06:13 UTC
Tree21b23cba16a5e0be87946888cc70d41bb647e5bb   Raw Patch
 
Fix(builder): Align Unix git mirror logic with Windows version
Fix(builder): Align Unix git mirror logic with Windows version

The git helper script for Unix (`git_helper_sh`) used a separate
`git fetch` and `git update-ref` sequence to update the local mirror.
This was inconsistent with the Windows script (`git_helper_bat`), which
uses a more robust, single `git fetch` command with a refspec.

This inconsistency could lead to a failure loop where the builder would
repeatedly try to fetch a local reference from the upstream remote,
causing the process to get stuck.

This commit modifies the `git_helper_sh` to use the same refspec
approach as the Windows script, fetching the remote ref directly into
the local `ref-<hash>` ref. This makes the mirroring logic consistent
across platforms and resolves the infinite loop issue.
diff --git a/src/builder/b-mirror.c b/src/builder/b-mirror.c index 05bb29a..9c63b3a 100644 --- a/src/builder/b-mirror.c +++ b/src/builder/b-mirror.c @@ -57,12 +57,8 @@ static const char * const git_helper_sh = " if [ ! -d \"$MIRROR_PATH/.git\" ]; then\n" " git init --bare \"$MIRROR_PATH\"\n" " fi\n" - " if [ \"$REF\" != \"$HASH\" ]; then\n" - " git -C \"$MIRROR_PATH\" fetch \"$REMOTE_URL\" \"$REF\"\n" - " else\n" - " git -C \"$MIRROR_PATH\" fetch \"$REMOTE_URL\" \"$HASH\"\n" - " fi\n" - " git -C \"$MIRROR_PATH\" update-ref \"ref-$HASH\" \"$HASH\"\n" + " REFSPEC=\"$REF:ref-$HASH\"\n" + " git -C \"$MIRROR_PATH\" fetch \"$REMOTE_URL\" \"+$REFSPEC\"\n" "elif [ \"$OPERATION\" == \"checkout\" ]; then\n" " MIRROR_PATH=$1\n" " BUILD_DIR=$2\n"
Page fetched 0s ago, creation time: 1ms (vhost etag hits: 0%, cache hits: 0%)