@@ -31,38 +31,51 @@ executed.
3131
3232## Changes
3333
34- - ` cmd/git/bootstrap.go ` : added ` CIGitCloneModeRequestedFromEnv() ` , an
35- exported helper that reports whether a detected CI provider plus
36- ` ATMOS_CI ` request CI checkout mode, without needing a resolved Cobra
37- command. It defers to the existing ` resolveCICloneMode ` so the
38- Cobra-aware and pre-Cobra code paths can't drift on ATMOS_CI/CI-provider
39- precedence.
40- - ` cmd/root.go ` : added ` isCIGitCloneBootstrapArgs(args) ` , an ` os.Args ` -based
41- equivalent of ` gitcmd.CICloneBootstrapRequested ` (checked before Cobra has
42- parsed anything), and wired it into ` handleConfigInitErrorWithArgs ` as a
43- new tolerance branch alongside the existing version/help/config-validation
44- branches.
34+ - ` cmd/root.go ` : added ` isCIGitCloneBootstrapArgs(args) ` , which isolates the
35+ clone-specific arguments from raw ` os.Args ` (stripping leading root flags
36+ and the ` atmos git clone ` tokens) and wires the result into
37+ ` handleConfigInitErrorWithArgs ` as a new tolerance branch alongside the
38+ existing version/help/config-validation branches.
39+ - ` cmd/git/bootstrap.go ` : added ` CIGitCloneBootstrapRequestedFromRawArgs ` ,
40+ which parses those clone-specific arguments against a throwaway
41+ ` *cobra.Command ` carrying the real clone flag set (a fresh
42+ ` newCloneParser() ` instance, never the shared package-level ` cloneParser `
43+ singleton, to avoid disturbing its registered command) via real ` pflag `
44+ parsing, then defers to the existing ` CICloneBootstrapRequested ` .
45+ - Iteration note: a first version of this fix used a hand-rolled
46+ ` "-" ` -prefix heuristic (and a separate ` CIGitCloneModeRequestedFromEnv `
47+ env-only helper) instead of real flag parsing. Dogfooding against the
48+ exact reported reproduction (` atmos git clone --ci --depth 0 ` ) caught that
49+ the heuristic misread the space-separated value ` 0 ` of ` --depth ` as a
50+ positional repo argument and wrongly fell back to the "profile not found"
51+ error. Replacing the heuristic with real ` pflag ` parsing (this fix's final
52+ form) fixes that and, as a side benefit, also lets an explicit
53+ ` --ci ` /` --ci=false ` in the raw args be honored before Cobra resolves the
54+ command.
4555
4656## Validation
4757
48- - New regression test ` TestHandleConfigInitError_CIGitCloneBootstrap `
49- (` cmd/root_helpers_test.go ` ) — confirmed it fails against the pre-fix code
50- (` ErrProfileNotFound ` returned instead of tolerated) and passes post-fix,
51- with negative cases (explicit repo argument, ` --all ` , no CI provider
52- detected) confirming the new branch doesn't over-tolerate.
58+ - New regression tests: ` TestHandleConfigInitError_CIGitCloneBootstrap `
59+ (` cmd/root_helpers_test.go ` , including the exact ` --ci --depth 0 `
60+ reproduction) and ` TestCIGitCloneBootstrapRequestedFromRawArgs `
61+ (` cmd/git/bootstrap_test.go ` , covering space- and equals-form value flags,
62+ ` --branch ` , positional args, ` --all ` , no-CI-provider, and malformed flag
63+ values) — confirmed both fail against the pre-fix code and pass post-fix.
5364- ` go build ./... ` , ` go vet ./cmd/... ` , ` gofmt ` — clean.
54- - ` go test ./cmd/... ./cmd/git/... ` (targeted: ` TestHandleConfigInitError* ` ,
55- ` TestApplyCIGitCloneBootstrap* ` , ` TestIsBuiltinConfigValidationCommand ` ,
56- ` TestCICloneBootstrapRequested* ` ) and full ` go test ./cmd/ ` — all pass.
65+ - Full ` go test ./cmd/ ./cmd/git/... ` — all pass.
5766- ` ./custom-gcl run ` via the repo's pre-commit hook — pass (had to build
5867 ` ./custom-gcl ` first via ` atmos lint custom-gcl ` ; it wasn't prebuilt in
5968 this worktree).
60- - Manual reproduction against a built binary in an empty directory:
61- ` ATMOS_PROFILE=github ATMOS_CI=true GITHUB_ACTIONS=true GITHUB_REPOSITORY=acme/repo atmos git clone `
62- no longer prints ` **Error:** profile not found ` ; it logs the missing
63- profile as a warning and proceeds into the real clone logic (which then
69+ - Manual reproduction against built binaries in an empty directory, for both
70+ ` atmos git clone ` (bare) and the exact reported
71+ ` atmos git clone --ci --depth 0 ` with
72+ ` ATMOS_PROFILE=github ATMOS_CI=true GITHUB_ACTIONS=true GITHUB_REPOSITORY=acme/repo ` :
73+ neither prints ` **Error:** profile not found ` ; both log the missing
74+ profile as a warning and proceed into the real clone logic (which then
6475 fails only because ` acme/repo ` doesn't exist — expected for the synthetic
65- repo used in this check).
76+ repo used in this check). Also confirmed the disqualifying cases
77+ (positional repo argument, ` --all ` ) still correctly show the profile
78+ error.
6679
6780## Follow-ups
6881
0 commit comments