commit - 4deef56fe9fdbfef7d2ecd12947ff515a0daae78
commit + 243a13f59c19fd9761211d200b68b77f99f6aded
blob - d6df04c0f3df601231396b5ce85997edcd0224a8
blob + 70cbc4d43a85f0b9cc32a0e589ac0f020b385ca1
--- lib/worktree.c
+++ lib/worktree.c
char *ondisk_path;
/* Reject merges into a work tree with mixed base commits. */
- if (memcmp(ie->commit_sha1, a->worktree->base_commit_id->sha1,
+ if (got_fileindex_entry_has_commit(ie) &&
+ memcmp(ie->commit_sha1, a->worktree->base_commit_id->sha1,
SHA1_DIGEST_LENGTH))
return got_error(GOT_ERR_MIXED_COMMITS);
blob - 5bfd952f5935c646f1b615cefc0ffb3b07d24e4a
blob + e38f0c962fdc4cd3c0ee01dba970d153b8fe6d2a
--- regress/cmdline/cherrypick.sh
+++ regress/cmdline/cherrypick.sh
local branch_rev=`git_show_head $testroot/repo`
+ echo "modified new file on branch" > $testroot/repo/epsilon/new
+ git_commit $testroot/repo -m "committing more changes on newbranch"
+ local branch_rev2=`git_show_head $testroot/repo`
+
(cd $testroot/wt && got cherrypick $branch_rev > $testroot/stdout)
echo "G alpha" > $testroot/stdout.expected
ret="$?"
if [ "$ret" != "0" ]; then
diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
fi
+
+ (cd $testroot/wt && got cherrypick $branch_rev2 > $testroot/stdout)
+
+ echo "G epsilon/new" > $testroot/stdout.expected
+ echo "Merged commit $branch_rev2" >> $testroot/stdout.expected
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo 'M alpha' > $testroot/stdout.expected
+ echo 'D beta' >> $testroot/stdout.expected
+ echo 'A epsilon/new' >> $testroot/stdout.expected
+
+ (cd $testroot/wt && got status > $testroot/stdout)
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ fi
test_done "$testroot" "$ret"
}