Skip to content

Commit 52185f1

Browse files
committed
fix(ci): stop storage-compat.sh from shallowing a full clone
The baseline fetch passed --depth=1 unconditionally. On the CI checkout that is a no-op, but on a developer's full clone git does not skip anything: it writes the fetched tip into .git/shallow and grafts every older commit off the history, for every worktree that shares the repository. A local run left master cut at its tip and git status counting the whole old history as remote-only commits. Pass --depth=1 only when the repository is already shallow.
1 parent 873b27e commit 52185f1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

scripts/ci/storage-compat.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,17 @@ fi
139139

140140
# The remote side of a fetch takes a branch or tag name (or a reachable SHA),
141141
# never a remote-tracking name, so drop the remote prefix before asking origin.
142+
#
143+
# --depth=1 only where the clone is already shallow (the CI checkout). On a
144+
# full clone that flag does not save anything, it WRITES a shallow boundary at
145+
# the fetched tip and grafts every older commit off the developer's history,
146+
# for every worktree sharing the repository.
147+
FETCH_DEPTH=()
148+
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
149+
FETCH_DEPTH=(--depth=1)
150+
fi
142151
FETCHED=0
143-
if git fetch --no-tags --depth=1 origin "${BASELINE_REF#origin/}" 2>/dev/null; then
152+
if git fetch --no-tags "${FETCH_DEPTH[@]}" origin "${BASELINE_REF#origin/}" 2>/dev/null; then
144153
FETCHED=1
145154
fi
146155

0 commit comments

Comments
 (0)