Pass proactiveAuth to git checkout for partial-clone lazy fetches
What does this MR do?
When FF_USE_GIT_PROACTIVE_AUTH is enabled, pass -c http.proactiveAuth=basic to git checkout in addition to git clone and git fetch.
In partial-clone repositories, git checkout can trigger a lazy fetch from the promisor remote to retrieve missing objects. That lazy fetch is a separate HTTP request that does not inherit -c flags from the original clone/fetch invocation, so the username is not propagated to Gitaly during those fetches.
Changes:
shells/abstract.go(writeCheckoutCmd): build checkout args dynamically, conditionally includinghttp.proactiveAuth=basicfunctions/concrete/run/stages/get_sources.go(gitCheckout): same change for the functions pathshells/abstract_test.go: addTestGitProactiveAuthCheckoutcovering enabled/disabled cases
Why was this MR needed?
See this discussion (internal link)
writeCheckoutCmd and gitCheckout hard-code only -c submodule.recurse=false and never check the UseGitProactiveAuth feature flag. The clone and fetch paths already pass this flag, but checkout was missed. This means that in partial-clone setups where checkout triggers a lazy fetch, the proactiveAuth setting is not applied, and the username is not propagated to Gitaly.
Observed in https://gitlab.com/gitlab-org/gitlab/-/jobs/14101195927 where FF_USE_GIT_PROACTIVE_AUTH:true was set and a lazy fetch during checkout failed without the proactiveAuth config.
What's the best way to test this MR?
- Run the new
TestGitProactiveAuthCheckoutunit test:go test -run TestGitProactiveAuthCheckout ./shells/ -count=1 - Verify existing
TestGitProactiveAuth(clone path) andTestGitCleanFlags(checkout path) still pass. - For an end-to-end check, enable
FF_USE_GIT_PROACTIVE_AUTHon a runner and run a job against a partial-clone repository. Confirm the checkout step's git command includes-c http.proactiveAuth=basicusingCI_DEBUG_TRACE: "true"