Summary
cds get --local <dir> is documented (CLI help text and README) as being
"mutually exclusive with --remote/--ref", but the actual mutual-exclusivity
check in cli/getter.py's _prepare_source_repository() only validates
remote:
if local is not None:
if remote is not None:
raise GetError("Specify only one of --remote and --local")
yield _validate_source_repository(Path(local).expanduser())
return
ref is never inspected in this branch. Since --ref defaults to "main"
(not None) on the CLI, there's no way to distinguish "user explicitly
passed --ref" from "using the default" -- but regardless, passing
--local together with an explicit --ref currently succeeds silently and
just ignores --ref, which contradicts the documented behavior.
Reproduction
cds get demo --local ./checkout --ref v2
This silently succeeds and copies from ./checkout at whatever state it's
currently in on disk -- --ref v2 has no effect and no warning/error is
raised, even though docs describe this combination as invalid.
Proposed fix
Pick one of:
- Enforce the documented exclusivity: raise a
GetError if local is set
and ref differs from the default (DEFAULT_REF), similar to the
existing --remote/--local check.
- Or, if silently ignoring
--ref with --local is fine, update the CLI
help text (cli/main.py) and README to stop claiming --ref is mutually
exclusive with --local.
Context
Raised during review of #493 (cds get GitHub tarball download), which
introduced --ref and --local flags. No existing test exercises the
--local + --ref combination.
Summary
cds get --local <dir>is documented (CLI help text and README) as being"mutually exclusive with
--remote/--ref", but the actual mutual-exclusivitycheck in
cli/getter.py's_prepare_source_repository()only validatesremote:refis never inspected in this branch. Since--refdefaults to"main"(not
None) on the CLI, there's no way to distinguish "user explicitlypassed
--ref" from "using the default" -- but regardless, passing--localtogether with an explicit--refcurrently succeeds silently andjust ignores
--ref, which contradicts the documented behavior.Reproduction
This silently succeeds and copies from
./checkoutat whatever state it'scurrently in on disk --
--ref v2has no effect and no warning/error israised, even though docs describe this combination as invalid.
Proposed fix
Pick one of:
GetErroriflocalis setand
refdiffers from the default (DEFAULT_REF), similar to theexisting
--remote/--localcheck.--refwith--localis fine, update the CLIhelp text (
cli/main.py) and README to stop claiming--refis mutuallyexclusive with
--local.Context
Raised during review of #493 (
cds getGitHub tarball download), whichintroduced
--refand--localflags. No existing test exercises the--local+--refcombination.