dolthub / dolt

Dolt – Git for Data
Apache License 2.0
17.72k stars 503 forks source link

Ghost Commit Error On Empty Merge #8148

Closed farhanhubble closed 1 month ago

farhanhubble commented 1 month ago

Reproduction:

Observation: "Ghost commit" error

Updating 7q8vh7e4l4qccfrt6vdqs6c1h8k00jml..7q8vh7e4l4qccfrt6vdqs6c1h8k00jml
merge successful, but could not calculate stats
error: unable to get diff summary from HEAD^1 to HEAD: runtime failure: Ghost commit encountered unexpectedly. Please report bug to: https://github.com/dolthub/dolt/issues

Additional Information

dolt version 1.42.3
macneale4 commented 1 month ago

Can you provide more details on the merge you are performing? I tested a fast forward merge and a simple merge in the following branch: https://github.com/dolthub/dolt/tree/macneale4/shallow-merge-error-investigation

If you can share the specific commands you ran, that would help a lot. Thanks!

farhanhubble commented 1 month ago

I don't have the exact command but here's what was happening.

farhanhubble commented 1 month ago

This was part of a larger automation script so its difficult to extract the exact commands but the same script ran sans errors if the diff wasn't empty.

farhanhubble commented 1 month ago

This line Updating 7q8vh7e4l4qccfrt6vdqs6c1h8k00jml..7q8vh7e4l4qccfrt6vdqs6c1h8k00jml from the merge error indicates that the new branch had nothing committed to it. I have updated the scenario above to stress this.

macneale4 commented 1 month ago

Ah, I see. It's a no-op merge. I can reproduce now.

The message is lousy, and I'll fix that. But worth calling out that the merge didn't actually do anything. All that happening is when we attempt to print the result of the merge it's confused about not being able to get information on the parent.

macneale4 commented 1 month ago

For reference, this is the behavior of git: No-op is detected, and "Already up to date." is printed with a 0 exit status.

lcl:/tmp/shallow_test$ git clone --depth 1 git@github.com:dolthub/dolt.git
Cloning into 'dolt'...
remote: Enumerating objects: 2411, done.
remote: Counting objects: 100% (2411/2411), done.
remote: Compressing objects: 100% (2160/2160), done.
remote: Total 2411 (delta 377), reused 856 (delta 148), pack-reused 0
Receiving objects: 100% (2411/2411), 8.25 MiB | 12.53 MiB/s, done.
Resolving deltas: 100% (377/377), done.
lcl:/tmp/shallow_test$ cd dolt
lcl:/tmp/shallow_test/dolt$ git log
commit dda3c30376b55d87d2e0fbce82ebd6560d58c1f2 (grafted, HEAD -> main, tag: v1.42.4, origin/main, origin/HEAD)
Author: coffeegoddd <coffeegoddd@users.noreply.github.com>
Date:   Fri Jul 26 02:37:27 2024 +0000

    [ga-bump-release] Update Dolt version to 1.42.4 and release v1.42.4
lcl:/tmp/shallow_test/dolt$ git checkout -b other HEAD
Switched to a new branch 'other'
lcl:/tmp/shallow_test/dolt$ git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
lcl:/tmp/shallow_test/dolt$ git merge other
Already up to date.
lcl:/tmp/shallow_test/dolt$