Skip to content

Commit 4acb0ba

Browse files
committed
feat: repo.sh - shallow cloning still tracks remote branches.
When setting SHALLOW_CLONE=1 setting for the `make dev.clone` target, developers are left with clones which cannot checkout remote branches for development. They are forced to search stackoverflow and ask AI bots how to fix this problem and discover an obscure command to fix their local clone. This PR just captures that work so others don't suffer.
1 parent fa6c178 commit 4acb0ba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

repo.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ _clone ()
164164
fi
165165
if [ "${SHALLOW_CLONE}" == "1" ]; then
166166
git clone ${CLONE_BRANCH} -c core.symlinks=true --depth=1 "${repo}"
167+
# Set up developers for success by tracking all remote branches, otherwise remote branches
168+
# cannot be checked-out. This only edits a text file, so it adds negligible time.
169+
pushd "${name}"
170+
git remote set-branches origin '*'
171+
popd
167172
else
168173
git clone ${CLONE_BRANCH} -c core.symlinks=true "${repo}"
169174
fi

0 commit comments

Comments
 (0)