# test: hoist -c config before the clone subcommand (Copilot review)

`2182fe0`·

Soph·1w ago·1 file·+16 added/-2 removed

Global -c applies to the transport for the invocation only; `git clone -c` would also persist the setting into the clone's .git/config. Matches the `git -c protocol.file.allow=always fetch` pattern used elsewhere.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>  
Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq

## Sessions

9d3594469d76View transcript

[?\  
Real Git-invoked Pre-push Hook Integration TestsClaude Code·2 steps](/content/gh/entireio/cli/session/cfc00e65-2a26-4afb-ac20-fc1509c10742#timeline-9d3594469d76/index.html)

## Changes

1

- cmd/entire/cli/integration_test

- Mtestenv.go+16/-2

```
1873 unmodified lines

1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1880
1881
1894
1895
1896
1897
1898

1873 unmodified lines

// Get the current branch name to clone the right branch
	currentBranch := env.GetCurrentBranch()

// Hoist "-c key=val" pairs before the clone subcommand: as a global git
	// option the config applies to the transport for this invocation only,
	// whereas `git clone -c` also persists it into the clone's .git/config.
	// Everything else stays a clone flag (--depth, --filter, ...).
	var globalArgs, cloneFlags []string
	for i := 0; i < len(extraArgs); i++ {
		if extraArgs[i] == "-c" && i+1 < len(extraArgs) {
			globalArgs = append(globalArgs, "-c", extraArgs[i+1])
			i++
			continue
		}
		cloneFlags = append(cloneFlags, extraArgs[i])
	}

// Clone the bare repo, explicitly checking out the right branch.
	// Bare repos may have HEAD pointing to a non-existent default branch
	// when the original was on a feature branch.
	cloneArgs := []string{"clone"}
	cloneArgs = append(cloneArgs, extraArgs...)
	cloneArgs := append(globalArgs, "clone")
	cloneArgs = append(cloneArgs, cloneFlags...)
	if currentBranch != "" {
		cloneArgs = append(cloneArgs, "--branch", currentBranch)
	}
```

Mcmd/entire/cli/integration_test/testenv.go+16/-2
