From fc6ea6df92c393d39f5bb99e8f4be5a445fa8a71 Mon Sep 17 00:00:00 2001 From: Stephanie You Date: Tue, 12 Sep 2023 11:25:45 -0700 Subject: [PATCH] fix formatting issue in status --- go/cmd/dolt/commands/status.go | 2 +- integration-tests/bats/status.bats | 49 +++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/go/cmd/dolt/commands/status.go b/go/cmd/dolt/commands/status.go index 23e073f3bd..a3ffc10263 100644 --- a/go/cmd/dolt/commands/status.go +++ b/go/cmd/dolt/commands/status.go @@ -503,7 +503,7 @@ and have %v and %v different commits each, respectively. `, remoteBranchRef, behind, s) changesPresent = true } else { - cli.Printf("Your branch is up to date with '%s'.", remoteBranchRef) + cli.Printf("Your branch is up to date with '%s'.\n", remoteBranchRef) } } diff --git a/integration-tests/bats/status.bats b/integration-tests/bats/status.bats index 9327e699a1..06bf60717e 100644 --- a/integration-tests/bats/status.bats +++ b/integration-tests/bats/status.bats @@ -23,7 +23,6 @@ get_head_commit() { } @test "status: no changes" { - dolt status run dolt status [ "$status" -eq 0 ] [[ "$output" =~ "On branch main" ]] || false @@ -488,3 +487,51 @@ SQL [[ "$output" =~ " (use \"dolt add -f \" to include in what will be committed)" ]] || false [[ "$output" =~ " new table: generated_foo" ]] || false } + +@test "status: with remote" { + mkdir remote + mkdir repo1 + + cd repo1 + dolt init + dolt remote add origin file://../remote + dolt push origin main + + cd .. + dolt clone file://./remote repo2 + cd repo2 + + run dolt status + [ "$status" -eq 0 ] + [[ "${lines[0]}" = "On branch main" ]] || false + [[ "${lines[1]}" = "Your branch is up to date with 'origin/main'." ]] || false + [[ "${lines[2]}" = "nothing to commit, working tree clean" ]] || false + + cd ../repo1 + dolt commit --allow-empty -m "cm1" + dolt push origin main + + cd ../repo2 + dolt fetch origin + run dolt status + [ "$status" -eq 0 ] + [[ "${lines[0]}" = "On branch main" ]] || false + [[ "${lines[1]}" = "Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded." ]] || false + [[ "${lines[2]}" = " (use \"dolt pull\" to update your local branch)" ]] || false + + dolt commit --allow-empty -m "cm2" + run dolt status + [ "$status" -eq 0 ] + [[ "${lines[0]}" = "On branch main" ]] || false + [[ "${lines[1]}" = "Your branch and 'origin/main' have diverged," ]] || false + [[ "${lines[2]}" = "and have 1 and 1 different commits each, respectively." ]] || false + [[ "${lines[3]}" = " (use \"dolt pull\" to update your local branch)" ]] || false + + dolt reset --hard origin/main + dolt commit --allow-empty -m "cm3" + run dolt status + [ "$status" -eq 0 ] + [[ "${lines[0]}" = "On branch main" ]] || false + [[ "${lines[1]}" = "Your branch is ahead of 'origin/main' by 1 commit." ]] || false + [[ "${lines[2]}" = " (use \"dolt push\" to publish your local commits)" ]] || false +}