Skip to content

Commit f34a452

Browse files
committed
docker: improve git fetch commands in Containerfile and entrypoint.sh
Updated git fetch commands to use --force for origin and --prune for upstream to ensure proper tag synchronization and repository state. Signed-off-by: Chiho Sin <[email protected]>
1 parent 8fd0f02 commit f34a452

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Containerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ ARG WORKSPACE_REPO_REF="main"
2929
RUN git config --global --add safe.directory /workspace \
3030
&& git clone "${WORKSPACE_REPO}" /workspace \
3131
&& git remote add upstream "${WORKSPACE_REPO_UPSTREAM}" \
32-
&& git fetch origin --tags \
33-
&& git fetch upstream --tags \
32+
&& git fetch upstream --tags --prune \
33+
&& git fetch origin --tags --force \
3434
&& git reset --hard "${WORKSPACE_REPO_REMOTE}/${WORKSPACE_REPO_REF}" \
3535
&& git repack -d
3636

3737
ARG WORKSPACE_BUILD_REMOTE="origin"
3838
ARG WORKSPACE_BUILD_REF="main"
3939
RUN echo "Hard reset repository to: ${WORKSPACE_REPO_REMOTE}/${WORKSPACE_REPO_REF}" \
40-
&& git fetch origin --tags --prune \
4140
&& git fetch upstream --tags --prune \
41+
&& git fetch origin --tags --force \
4242
&& git fetch "${WORKSPACE_BUILD_REMOTE}" "${WORKSPACE_BUILD_REF}" \
4343
&& git reset --hard FETCH_HEAD \
4444
&& git repack -d \

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ JOBS=$(nproc)
1414

1515
# Reset to the target SHA
1616
git fetch upstream --tags --prune
17-
git fetch origin --tags --prune
17+
git fetch origin --tags --force
1818
git fetch "${REPO_REMOTE}" "${REPO_REF}"
1919
git reset --hard FETCH_HEAD
2020
git repack -d

0 commit comments

Comments
 (0)