Teach the .git/config guard the skipFetchAll stamp · Entire

Teach the .git/config guard the skipFetchAll stamp

4fab7de→main · toothbrush · 4d ago · 1 file · +12 added/-5 removed

The integration harness normalizes away exactly the URL-keyed promisor+partialclonefilter pair git writes during filtered fetches; the new skipFetchAll/skipDefaultUpdate stamp made the section no longer match, tripping the guard in TestHTTPS_OutOfSyncCheckpointBranchRebases. Allow the two stamp keys in the section while still failing loudly when the core promisor pair is incomplete or any other key appears.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Changes

1

312 unmodified lines

var gitConfigGuardRepositoryFormatVersionRE = regexp.MustCompile(`(?m)^([ \t]*)repositoryformatversion = [01]$`)

var gitConfigGuardTransportPromisorRemoteRE = regexp.MustCompile(
    `(?m)^
    \[remote "(?:(?:https?|ssh|file)://|/|[A-Za-z]:[\\]|[^"\n]+@[^"\n]+:[^"\n]+).+"\]
    (?:[ \t]+promisor = true\n[ \t]+partialclonefilter = blob:none\n?|[ \t]+partialclonefilter = blob:none\n[ \t]+promisor = true\n?)`,
    `(?m)^\[remote "(?:(?:https?|ssh|file)://|/|[A-Za-z]:[\\]|[^"\n]+@[^"\n]+:[^"\n]+).+"\]
    (?:[ \t]+(?:promisor = true|partialclonefilter = blob:none|skipFetchAll = true|skipDefaultUpdate = true)\n?){2,4}`,
)

func normalizeGitConfigForGuard(content string) string {
    content = gitConfigGuardRepositoryFormatVersionRE.ReplaceAllString(content, `${1}repositoryformatversion = <normalized>`)
    // Deliberately ignore only the full promisor+partialclonefilter pair that
    // git writes for transport-keyed remotes during filtered fetches. If git ever
    // writes a partial section, the guard should still fail loudly.
    content = gitConfigGuardTransportPromisorRemoteRE.ReplaceAllString(content, "")
    // Deliberately ignore only the URL-keyed remote sections written during
    // filtered fetches: git's promisor+partialclonefilter pair plus the
    // skipFetchAll/skipDefaultUpdate stamp the CLI adds so bulk fetches skip
    // the entry. A section without the full promisor pair (or with any other
    // key) still fails loudly.
    content = gitConfigGuardTransportPromisorRemoteRE.ReplaceAllStringFunc(content, func(section string) string {
        if strings.Contains(section, "promisor = true") && strings.Contains(section, "partialclonefilter = blob:none") {
            return ""
        }
        return section
    })
    return content
}

Mcmd/entire/cli/integration_test/testenv.go +12/-5