From 4acb0baf7de2ae1b3e04570f9bb9ddea099d16ee Mon Sep 17 00:00:00 2001 From: Troy Sankey Date: Mon, 12 May 2025 15:49:43 -0700 Subject: [PATCH] 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. --- repo.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repo.sh b/repo.sh index 61d6546b..9425053e 100755 --- a/repo.sh +++ b/repo.sh @@ -164,6 +164,11 @@ _clone () fi if [ "${SHALLOW_CLONE}" == "1" ]; then git clone ${CLONE_BRANCH} -c core.symlinks=true --depth=1 "${repo}" + # Set up developers for success by tracking all remote branches, otherwise remote branches + # cannot be checked-out. This only edits a text file, so it adds negligible time. + pushd "${name}" + git remote set-branches origin '*' + popd else git clone ${CLONE_BRANCH} -c core.symlinks=true "${repo}" fi