Skip to content

Commit

Permalink
Make a copy of args passed to make_dbt_context
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeatty10 committed Mar 23, 2024
1 parent a12ec1b commit 79227b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/dbt/cli/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def make_context(args, command=dbt) -> Optional[click.Context]:
try:
ctx = command.make_context(command.name, args)
ctx = command.make_context(command.name, args.copy())

Check warning on line 9 in core/dbt/cli/context.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/cli/context.py#L9

Added line #L9 was not covered by tests
except click.exceptions.Exit:
return None

Expand Down
6 changes: 3 additions & 3 deletions core/dbt/cli/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def args_to_context(args: List[str]) -> Context:
"""Convert a list of args to a click context with proper hierarchy for dbt commands"""
from dbt.cli.main import cli

cli_ctx = cli.make_context(cli.name, args)
cli_ctx = cli.make_context(cli.name, args.copy())

Check warning on line 67 in core/dbt/cli/flags.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/cli/flags.py#L67

Added line #L67 was not covered by tests
# Split args if they're a comma separated string.
if len(args) == 1 and "," in args[0]:
args = args[0].split(",")
Expand All @@ -74,7 +74,7 @@ def args_to_context(args: List[str]) -> Context:
sub_command_name, sub_command, args = sub_command.resolve_command(cli_ctx, args)

assert isinstance(sub_command, ClickCommand)
sub_command_ctx = sub_command.make_context(sub_command_name, args)
sub_command_ctx = sub_command.make_context(sub_command_name, args.copy())

Check warning on line 77 in core/dbt/cli/flags.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/cli/flags.py#L77

Added line #L77 was not covered by tests
sub_command_ctx.parent = cli_ctx
return sub_command_ctx

Expand Down Expand Up @@ -218,7 +218,7 @@ def _assign_params(
invoked_subcommand = getattr(import_module("dbt.cli.main"), invoked_subcommand_name)
invoked_subcommand.allow_extra_args = True
invoked_subcommand.ignore_unknown_options = True
invoked_subcommand_ctx = invoked_subcommand.make_context(None, sys.argv)
invoked_subcommand_ctx = invoked_subcommand.make_context(None, sys.argv.copy())

Check warning on line 221 in core/dbt/cli/flags.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/cli/flags.py#L221

Added line #L221 was not covered by tests
_assign_params(
invoked_subcommand_ctx,
params_assigned_from_default,
Expand Down

0 comments on commit 79227b4

Please sign in to comment.