mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-07 00:39:44 -06:00
up to date error returns 0 status code
This commit is contained in:
@@ -203,7 +203,8 @@ func handlePushError(err error, usage cli.UsagePrinter, apr *argparser.ArgParseR
|
||||
var verr errhand.VerboseError
|
||||
switch err {
|
||||
case doltdb.ErrUpToDate:
|
||||
verr = errhand.BuildDError("Everything up-to-date.").Build()
|
||||
cli.Println("Everything up-to-date.")
|
||||
return 0
|
||||
case env.ErrNoUpstreamForBranch:
|
||||
rows, err := GetRowsForSql(queryist, sqlCtx, "select active_branch()")
|
||||
if err != nil {
|
||||
|
||||
@@ -277,6 +277,9 @@ func (cmd SqlCmd) Exec(ctx context.Context, commandStr string, args []string, dE
|
||||
func sqlHandleVErrAndExitCode(queryist cli.Queryist, verr errhand.VerboseError, usage cli.UsagePrinter) int {
|
||||
if verr != nil {
|
||||
if msg := verr.Verbose(); strings.TrimSpace(msg) != "" {
|
||||
if strings.Contains(msg, "up to date") {
|
||||
return 0
|
||||
}
|
||||
cli.PrintErrln(msg)
|
||||
}
|
||||
|
||||
|
||||
@@ -243,6 +243,9 @@ func (cmd SqlClientCmd) Exec(ctx context.Context, commandStr string, args []stri
|
||||
|
||||
rows, err := conn.Query(query)
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "up to date") {
|
||||
return 0
|
||||
}
|
||||
cli.PrintErrln(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ var doltPushSchema = []*sql.Column{
|
||||
func doltPush(ctx *sql.Context, args ...string) (sql.RowIter, error) {
|
||||
res, message, err := doDoltPush(ctx, args)
|
||||
if err != nil {
|
||||
if err == doltdb.ErrUpToDate {
|
||||
return rowToIter(int64(cmdSuccess)), doltdb.ErrUpToDate
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return rowToIter(int64(res), message), nil
|
||||
|
||||
@@ -134,7 +134,7 @@ teardown() {
|
||||
dolt push -u origin other
|
||||
# upstream should be set still
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
[[ ! "$output" =~ "The current branch main has no upstream branch." ]] || false
|
||||
}
|
||||
@@ -150,7 +150,7 @@ teardown() {
|
||||
dolt push
|
||||
# upstream should be set still
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
[[ ! "$output" =~ "The current branch main has no upstream branch." ]] || false
|
||||
}
|
||||
@@ -166,7 +166,7 @@ teardown() {
|
||||
dolt push
|
||||
# upstream should be set still
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
[[ ! "$output" =~ "The current branch main has no upstream branch." ]] || false
|
||||
}
|
||||
|
||||
@@ -193,9 +193,7 @@ teardown() {
|
||||
cd repo1
|
||||
dolt checkout -b new_feature
|
||||
dolt push remote1 new_feature
|
||||
run dolt push remote1 main
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
dolt push remote1 main
|
||||
|
||||
cd ../repo2
|
||||
dolt config --local --add sqlserver.global.dolt_read_replica_remote remote1
|
||||
@@ -225,9 +223,7 @@ teardown() {
|
||||
dolt push remote1 b2
|
||||
dolt push remote1 b3
|
||||
dolt checkout main
|
||||
run dolt push remote1 main
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
dolt push remote1 main
|
||||
|
||||
cd ../repo2
|
||||
dolt config --local --add sqlserver.global.dolt_read_replica_remote remote1
|
||||
@@ -412,9 +408,7 @@ teardown() {
|
||||
dolt commit -am "first commit"
|
||||
dolt push remote1 feature
|
||||
dolt checkout main
|
||||
run dolt push remote1 main
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
dolt push remote1 main
|
||||
|
||||
cd ../repo2
|
||||
dolt fetch
|
||||
@@ -453,9 +447,7 @@ teardown() {
|
||||
dolt commit -am "first commit"
|
||||
dolt push remote1 feature
|
||||
dolt checkout main
|
||||
run dolt push remote1 main
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
dolt push remote1 main
|
||||
|
||||
cd ../repo2
|
||||
dolt fetch
|
||||
@@ -492,9 +484,7 @@ teardown() {
|
||||
dolt commit -am "first commit"
|
||||
dolt push remote1 feature
|
||||
dolt checkout main
|
||||
run dolt push remote1 main
|
||||
[ $status -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
dolt push remote1 main
|
||||
|
||||
cd ../repo2
|
||||
dolt fetch
|
||||
|
||||
@@ -350,7 +350,7 @@ SQL
|
||||
[[ "$output" =~ "Uploading" ]] || false
|
||||
|
||||
run dolt push test-remote main
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
}
|
||||
|
||||
@@ -997,7 +997,7 @@ SQL
|
||||
dolt push test-remote main
|
||||
cd "dolt-repo-clones/test-repo"
|
||||
run dolt push origin main
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
dolt fetch
|
||||
run dolt push origin main
|
||||
@@ -1843,9 +1843,7 @@ setup_ref_test() {
|
||||
cd dolt-repo-clones
|
||||
dolt clone http://localhost:50051/test-org/test-repo
|
||||
cd test-repo
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
dolt push
|
||||
}
|
||||
|
||||
@test "remotes: set upstream succeeds even if up to date" {
|
||||
@@ -1861,12 +1859,8 @@ setup_ref_test() {
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "The current branch feature has no upstream branch." ]] || false
|
||||
run dolt push --set-upstream origin feature
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date." ]] || false
|
||||
dolt push --set-upstream origin feature
|
||||
dolt push
|
||||
}
|
||||
|
||||
@test "remotes: local clone does not contain working set changes" {
|
||||
|
||||
@@ -40,7 +40,7 @@ push_helper() {
|
||||
TMPDIRS=$1
|
||||
for i in {1..3}; do
|
||||
cd "${TMPDIRS}/dbs1/repo${i}"
|
||||
run dolt push remote1 main # Everything up-to-date returns an error code
|
||||
dolt push remote1 main
|
||||
done
|
||||
cd $TMPDIRS
|
||||
}
|
||||
|
||||
@@ -365,9 +365,7 @@ teardown() {
|
||||
dolt checkout other
|
||||
# this checkout will not set upstream because this 'feature' branch existed before matching remote tracking branch was created
|
||||
dolt checkout feature
|
||||
run dolt push --set-upstream origin feature
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
dolt push --set-upstream origin feature
|
||||
|
||||
cd ../repo1
|
||||
dolt merge main
|
||||
|
||||
@@ -212,7 +212,7 @@ SQL
|
||||
dolt sql -q "call dolt_push('-u', 'origin', 'other')"
|
||||
# upstream should be set still
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
[[ ! "$output" =~ "The current branch main has no upstream branch." ]] || false
|
||||
}
|
||||
@@ -228,7 +228,7 @@ SQL
|
||||
dolt sql -q "call dolt_push()"
|
||||
# upstream should be set still
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
[[ ! "$output" =~ "The current branch main has no upstream branch." ]] || false
|
||||
}
|
||||
@@ -244,7 +244,7 @@ SQL
|
||||
dolt sql -q "call dolt_push()"
|
||||
# upstream should be set still
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]] || false
|
||||
[[ ! "$output" =~ "The current branch main has no upstream branch." ]] || false
|
||||
}
|
||||
@@ -259,7 +259,7 @@ SQL
|
||||
dolt sql -q "call dolt_push('-u', 'origin', 'other')"
|
||||
# upstream should be set still
|
||||
run dolt push
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ! "$output" =~ "The current branch main has no upstream branch." ]] || false
|
||||
}
|
||||
|
||||
|
||||
@@ -1075,13 +1075,9 @@ END""")
|
||||
[ $status -ne 0 ]
|
||||
[[ "$output" =~ "the current branch has no upstream branch" ]] || false
|
||||
|
||||
run dolt sql-client -P $PORT -u dolt --use-db repo1 -q "call dolt_push('--set-upstream', 'origin', 'main')"
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "up to date" ]] || false
|
||||
dolt sql-client -P $PORT -u dolt --use-db repo1 -q "call dolt_push('--set-upstream', 'origin', 'main')"
|
||||
|
||||
run dolt sql-client -P $PORT -u dolt --use-db repo1 -q "call dolt_push()"
|
||||
[ $status -eq 1 ]
|
||||
[[ $output =~ "up to date" ]] || false
|
||||
dolt sql-client -P $PORT -u dolt --use-db repo1 -q "call dolt_push()"
|
||||
}
|
||||
|
||||
@test "sql-server: replicate to backup after sql-session commit" {
|
||||
|
||||
Reference in New Issue
Block a user