mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-14 01:07:08 -06:00
Add auth to dolt pull
This commit is contained in:
@@ -256,6 +256,7 @@ func CreatePullArgParser() *argparser.ArgParser {
|
||||
ap.SupportsFlag(CommitFlag, "", "Perform the merge and commit the result. This is the default option, but can be overridden with the --no-commit flag. Note that this option does not affect fast-forward merges, which don't create a new merge commit, and if any merge conflicts or constraint violations are detected, no commit will be attempted.")
|
||||
ap.SupportsFlag(NoCommitFlag, "", "Perform the merge and stop just before creating a merge commit. Note this will not prevent a fast-forward merge; use the --no-ff arg together with the --no-commit arg to prevent both fast-forwards and merge commits.")
|
||||
ap.SupportsFlag(NoEditFlag, "", "Use an auto-generated commit message when creating a merge commit. The default for interactive CLI sessions is to open an editor.")
|
||||
ap.SupportsString(UserParam, "u", "user", "User name to use when authenticating with the remote. Gets password from the environment variable {{.EmphasisLeft}}DOLT_REMOTE_PASSWORD{{.EmphasisRight}}.")
|
||||
return ap
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,8 @@ func (cmd PullCmd) Exec(ctx context.Context, commandStr string, args []string, d
|
||||
return HandleVErrAndExitCode(errhand.VerboseErrorFromError(env.ErrActiveServerLock.New(dEnv.LockFile())), help)
|
||||
}
|
||||
|
||||
dEnv.UserPassConfig = getUserAndPassConfig(apr)
|
||||
|
||||
pullSpec, err := env.NewPullSpec(ctx, dEnv.RepoStateReader(), remoteName, remoteRefName, apr.Contains(cli.SquashParam), apr.Contains(cli.NoFFParam), apr.Contains(cli.NoCommitFlag), apr.Contains(cli.NoEditFlag), apr.Contains(cli.ForceFlag), apr.NArg() == 1)
|
||||
if err != nil {
|
||||
return HandleVErrAndExitCode(errhand.VerboseErrorFromError(err), usage)
|
||||
|
||||
@@ -186,10 +186,16 @@ insert into vals (i) values (6), (7), (8), (9), (10);
|
||||
call dolt_commit('-am', 'add some vals');
|
||||
SQL
|
||||
|
||||
# TODO: Add auth to dolt pull
|
||||
# No auth
|
||||
run dolt pull
|
||||
[[ "$status" != 0 ]] || false
|
||||
[[ "$output" =~ "Unauthenticated" ]] || false
|
||||
|
||||
# With auth
|
||||
run dolt pull -u $DOLT_REMOTE_USER
|
||||
[[ "$status" -eq 0 ]] || false
|
||||
run dolt sql -q 'select count(*) from vals;'
|
||||
[[ "$output" =~ "10" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-server-remotesrv: dolt clone without authentication errors" {
|
||||
|
||||
Reference in New Issue
Block a user