mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-11 00:59:50 -06:00
dolt merge doesn't fail if unable to get hash
This commit is contained in:
@@ -149,19 +149,21 @@ func (cmd MergeCmd) Exec(ctx context.Context, commandStr string, args []string,
|
||||
|
||||
// calculate merge stats
|
||||
if !apr.Contains(cli.AbortParam) {
|
||||
mergeHash, err := getHashOf(queryist, sqlCtx, apr.Arg(0))
|
||||
if err != nil {
|
||||
//todo: refs with the `remotes/` prefix will fail to get a hash
|
||||
mergeHash, mergeHashErr := getHashOf(queryist, sqlCtx, apr.Arg(0))
|
||||
if mergeHashErr != nil {
|
||||
cli.Println("merge finished, but failed to get hash of merge ref")
|
||||
cli.Println(err.Error())
|
||||
return 0
|
||||
cli.Println(mergeHashErr.Error())
|
||||
}
|
||||
headHash, err := getHashOf(queryist, sqlCtx, "HEAD")
|
||||
if err != nil {
|
||||
headHash, headhHashErr := getHashOf(queryist, sqlCtx, "HEAD")
|
||||
if headhHashErr != nil {
|
||||
cli.Println("merge finished, but failed to get hash of HEAD")
|
||||
cli.Println(err.Error())
|
||||
return 0
|
||||
cli.Println(headhHashErr.Error())
|
||||
}
|
||||
cli.Println("Updating", headHash+".."+mergeHash)
|
||||
if mergeHashErr == nil && headhHashErr == nil {
|
||||
cli.Println("Updating", headHash+".."+mergeHash)
|
||||
}
|
||||
|
||||
if apr.Contains(cli.SquashParam) {
|
||||
cli.Println("Squash commit -- not updating HEAD")
|
||||
}
|
||||
|
||||
@@ -940,12 +940,12 @@ SQL
|
||||
[[ ! "$output" =~ "test commit" ]] || false
|
||||
run dolt merge origin/main
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "up-to-date" ]]
|
||||
[[ "$output" =~ "Already up to date." ]] || false
|
||||
run dolt fetch
|
||||
[ "$status" -eq 0 ]
|
||||
run dolt merge origin/main
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Fast-forward" ]]
|
||||
[[ "$output" =~ "Fast-forward" ]] || false
|
||||
run dolt log
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "test commit" ]] || false
|
||||
@@ -974,12 +974,12 @@ SQL
|
||||
cd "dolt-repo-clones/test-repo"
|
||||
run dolt merge remotes/origin/main
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Everything up-to-date" ]]
|
||||
[[ "$output" =~ "Already up to date." ]] || false
|
||||
run dolt fetch origin main
|
||||
[ "$status" -eq 0 ]
|
||||
run dolt merge remotes/origin/main
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "Fast-forward" ]]
|
||||
[[ "$output" =~ "Fast-forward" ]] || false
|
||||
}
|
||||
|
||||
@test "remotes: try to push a remote that is behind tip" {
|
||||
|
||||
Reference in New Issue
Block a user