Skip to content

Commit

Permalink
ci_runner: conditionally set extension.partialClone based on filter
Browse files Browse the repository at this point in the history
If the filter is empty, unset the config.
If the filter is available, set the config to "origin" to indicate the
remote is a promisor remote.

https://github.com/git/git/blob/08bdfd453584e489d5a551aecbdcb77584e1b958/Documentation/config/extensions.adoc?plain=1#L37-L47
  • Loading branch information
sluongng committed Feb 27, 2025
1 parent c7fe7c7 commit e25cae0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions enterprise/server/cmd/ci_runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1963,10 +1963,6 @@ func (ws *workspace) config(ctx context.Context) error {
{"user.email", "[email protected]"},
{"user.name", "BuildBuddy"},
{"advice.detachedHead", "false"},
// With the version of git that we have installed in the CI runner
// image, --filter=blob:none requires the partialClone extension to be
// enabled.
{"extensions.partialClone", "true"},
// Disable this check for `git fetch` performance improvements
{"fetch.showForcedUpdates", "false"},
// Disable automatic gc - it can interfere with running `rm -rf .git` in
Expand All @@ -1981,6 +1977,16 @@ func (ws *workspace) config(ctx context.Context) error {
// displays a blocking popup dialog)
cfg = append(cfg, []string{"credential.helper", ""})
}
if len(*gitFetchFilters) > 0 {
// With the version of git that we have installed in the CI runner
// image, --filter=blob:none requires the partialClone extension to be
// enabled.
cfg = append(cfg, []string{"extensions.partialClone", "origin"})
} else {
if _, err := git(ctx, io.Discard, "config", "unset", "extensions.partialClone"); err != nil {
return err
}
}

writeCommandSummary(ws.log, "Configuring repository...")
for _, kv := range cfg {
Expand Down

0 comments on commit e25cae0

Please sign in to comment.