mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-06 00:39:40 -06:00
Bug fix and tests for specifying --prune with a refspec
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user