diff --git a/go/cmd/dolt/commands/fetch.go b/go/cmd/dolt/commands/fetch.go index 821e94e98c..29fbf9ef5c 100644 --- a/go/cmd/dolt/commands/fetch.go +++ b/go/cmd/dolt/commands/fetch.go @@ -110,7 +110,7 @@ func (cmd FetchCmd) Exec(ctx context.Context, commandStr string, args []string, // validateFetchArgs returns an error if the arguments provided aren't valid. func validateFetchArgs(apr *argparser.ArgParseResults, refSpecArgs []string) errhand.VerboseError { - if len(refSpecArgs) > 0 && apr.ContainsArg(cli.PruneFlag) { + if len(refSpecArgs) > 0 && apr.Contains(cli.PruneFlag) { // The current prune implementation assumes that we're processing branch specs, which return errhand.BuildDError("--prune option cannot be provided with a ref spec").Build() } diff --git a/go/libraries/doltcore/sqle/dprocedures/dolt_fetch.go b/go/libraries/doltcore/sqle/dprocedures/dolt_fetch.go index 0b9eb16546..8d3fb52e59 100644 --- a/go/libraries/doltcore/sqle/dprocedures/dolt_fetch.go +++ b/go/libraries/doltcore/sqle/dprocedures/dolt_fetch.go @@ -89,7 +89,7 @@ func doDoltFetch(ctx *sql.Context, args []string) (int, error) { // validateFetchArgs returns an error if the arguments provided aren't valid. func validateFetchArgs(apr *argparser.ArgParseResults, refSpecArgs []string) error { - if len(refSpecArgs) > 0 && apr.ContainsArg(cli.PruneFlag) { + if len(refSpecArgs) > 0 && apr.Contains(cli.PruneFlag) { // The current prune implementation assumes that we're processing branch specs, which return fmt.Errorf("--prune option cannot be provided with a ref spec") } diff --git a/integration-tests/bats/remotes.bats b/integration-tests/bats/remotes.bats index ef677df750..b5c9e9092f 100644 --- a/integration-tests/bats/remotes.bats +++ b/integration-tests/bats/remotes.bats @@ -2420,4 +2420,8 @@ SQL [ "$status" -eq 0 ] [[ ! "$output" =~ "origin/b1" ]] || false [[ ! "$output" =~ "remote2/b2" ]] || false + + run dolt fetch --prune remote2 'refs/heads/main:refs/remotes/remote2/othermain' + [ "$status" -ne 0 ] + [[ "$output" =~ "--prune option cannot be provided with a ref spec" ]] || false } diff --git a/integration-tests/bats/sql-fetch.bats b/integration-tests/bats/sql-fetch.bats index b8f887edc6..d3e2b965ce 100644 --- a/integration-tests/bats/sql-fetch.bats +++ b/integration-tests/bats/sql-fetch.bats @@ -431,6 +431,10 @@ teardown() { [ "$status" -eq 0 ] [[ ! "$output" =~ "origin/b1" ]] || false [[ ! "$output" =~ "remote2/b2" ]] || false + + run dolt sql -q "call dolt_fetch('--prune', 'remote2', 'refs/heads/main:refs/remotes/remote2/othermain')" + [ "$status" -ne 0 ] + [[ "$output" =~ "--prune option cannot be provided with a ref spec" ]] || false } @test "sql-fetch: dolt_fetch unknown remote fails" {