| Author | |
| Committer | |
| Tree | 21b23cba16a5e0be87946888cc70d41bb647e5bb |
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"