mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-28 18:30:02 -06:00
Merge pull request #9155 from meirdev/fix-status-command
fix status command after removing origin from remote
This commit is contained in:
@@ -335,8 +335,10 @@ func getRemoteInfo(queryist cli.Queryist, sqlCtx *sql.Context, branchName string
|
||||
if err != nil {
|
||||
return ahead, behind, err
|
||||
}
|
||||
if len(remoteBranches) != 1 {
|
||||
return ahead, behind, fmt.Errorf("could not find remote branch %s", remoteBranchRef)
|
||||
if len(remoteBranches) > 1 {
|
||||
return ahead, behind, fmt.Errorf("runtime error: too many results returned for remote branch %s", remoteBranchRef)
|
||||
} else if len(remoteBranches) == 0 {
|
||||
return ahead, behind, nil
|
||||
}
|
||||
remoteBranchCommit := remoteBranches[0][1].(string)
|
||||
|
||||
|
||||
@@ -580,3 +580,27 @@ SQL
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "modified: t1" ]] || false
|
||||
}
|
||||
|
||||
@test "status: after remove 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 remote -v
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "origin file:///" ]] || false
|
||||
|
||||
dolt remote rm origin
|
||||
|
||||
run dolt status
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "On branch main" ]] || false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user