Download raw body.
three bugs related to merge commits
On Mon, Apr 17, 2023 at 04:06:00PM +0000, James Cook wrote:
> > Thanks!
> > Below is a fix with your test adjusted to expect correct behaviour.
> >
> > The bug is that the first parent's object ID was derived from the work
> > tree's base commit. It should be derived from the branch tip commit.
> > The comitted tree is already based on the branch tip's tree which is
> > why the added file did not disappear.
> >
> > It is unfortunate that the test suite didn't already catch such a basic
> > problem, but here we are. All other tests are still passing for me.
>
> Thanks, that fixes the first bug! The other two still seem to be present
> though.
>
> Here's a patch adding regress tests for the other two.
> test_merge_same_change (for the third bug) seems to almost directly
> contradict test_merge_no_op, though, so maybe the third bug is intended
> behaviour? It would be nice to have a way to create a merge commit in
> this situation. (I think it's actually come up for me, but now I forget
> how).
>
> test_send_merge_commit is for the second bug.
Updated patch:
- Dropped the test for the third bug (test_merge_same_change).
- Fixed test_send_merge_commit:
- Merge origin/master into master, not vice versa.
- Check return value of got up && got merge, just in case.
--
James
diff /home/falsifian/co/got
commit - 2b70695630ead3274d31727f6b477f3544dc9c9a
path + /home/falsifian/co/got
blob - db8ed49392c78fe028db90d4d5c318b3d0fa8130
file + regress/cmdline/send.sh
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
@@ -322,6 +322,44 @@ test_send_delete() {
test_done "$testroot" "$ret"
}
+test_send_merge_commit() {
+ local testroot=`test_init send_merge_commit`
+ local testurl=ssh://127.0.0.1/$testroot
+
+ if ! got clone -q "$testurl/repo" "$testroot/repo-clone"; then
+ echo "got clone command failed unexpectedly" >&2
+ test_done "$testroot" 1
+ return 1
+ fi
+
+ echo 'upstream change' > $testroot/repo/alpha
+ git_commit $testroot/repo -m 'upstream change'
+
+ got checkout $testroot/repo-clone $testroot/wt-clone > /dev/null
+ echo 'downstream change' > $testroot/wt-clone/beta
+ (cd $testroot/wt-clone && got commit -m 'downstream change' > /dev/null)
+
+ got fetch -q -r $testroot/repo-clone
+ (cd $testroot/wt-clone && got up && got merge origin/master > /dev/null)
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "got merge command failed unexpectedly" >&2
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ (cd $testroot/repo && git config receive.denyCurrentBranch ignore)
+
+ got send -r $testroot/repo-clone > /dev/null
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ test_done "$testroot" 0
+}
+
test_send_delete() {
local testroot=`test_init send_delete`
local testurl=ssh://127.0.0.1/$testroot
@@ -1583,6 +1621,7 @@ run_test test_send_delete
run_test test_send_basic
run_test test_send_rebase_required
run_test test_send_rebase_required_overwrite
+run_test test_send_merge_commit
run_test test_send_delete
run_test test_send_clone_and_send
run_test test_send_tags
three bugs related to merge commits