add tests for the bug fixed in commit 1fee9f40e2ed335d4ec8899954b59b43990b97c3 one of these tests is still failing; there is another edge case left to fix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
diff --git a/regress/cmdline/cherrypick.sh b/regress/cmdline/cherrypick.sh
index 31ae890..a11bcd4 100755
--- a/regress/cmdline/cherrypick.sh
+++ b/regress/cmdline/cherrypick.sh
@@ -779,6 +779,88 @@ test_cherrypick_with_path_prefix_and_empty_tree() {
test_done "$testroot" "$ret"
}
+test_cherrypick_conflict_no_eol() {
+ local testroot=`test_init cherrypick_conflict_no_eol 1`
+ local content_a="aaa\naaa\naaa\naaa\naaa\naaa\n"
+ local content_b="aaa\naaa\nbbb\naaa\naaa\naaa\naaa"
+ local content_c="aaa\naaa\nccc\naaa\naaa\naaa\naaa"
+
+ printf "$content_a" > $testroot/repo/a
+ (cd $testroot/repo && git add a)
+ git_commit $testroot/repo -m "initial commit"
+
+ (cd $testroot/repo && got branch newbranch)
+
+ printf "$content_b" > $testroot/repo/a
+ git_commit $testroot/repo -m "change bbb"
+
+ printf "$content_c" > $testroot/repo/a
+ git_commit $testroot/repo -m "change ccc"
+ local ccc_commit=`git_show_head $testroot/repo`
+
+ got checkout -b newbranch $testroot/repo $testroot/wt > /dev/null
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ (cd $testroot/wt && got cherrypick $ccc_commit > $testroot/stdout)
+
+ echo "C a" > $testroot/stdout.expected
+ echo "Merged commit $ccc_commit" >> $testroot/stdout.expected
+ echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ fi
+ test_done "$testroot" "$ret"
+}
+
+test_cherrypick_conflict_no_eol2() {
+ local testroot=`test_init cherrypick_conflict_no_eol2 1`
+ local content_a="aaa\naaa\naaa\naaa\naaa\naaa"
+ local content_b="aaa\naaa\nbbb\naaa\naaa\naaa"
+ local content_c="aaa\naaa\nbbb\naaa\naaa\naaa\n"
+
+ printf "$content_a" > $testroot/repo/a
+ (cd $testroot/repo && git add a)
+ git_commit $testroot/repo -m "initial commit"
+
+ (cd $testroot/repo && got branch newbranch)
+
+ printf "$content_b" > $testroot/repo/a
+ git_commit $testroot/repo -m "change bbb"
+
+ printf "$content_c" > $testroot/repo/a
+ git_commit $testroot/repo -m "change ccc"
+ local ccc_commit=`git_show_head $testroot/repo`
+
+ got checkout -b newbranch $testroot/repo $testroot/wt > /dev/null
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ (cd $testroot/wt && got cherrypick $ccc_commit \
+ > $testroot/stdout 2> $testroot/stderr)
+
+ echo "C a" > $testroot/stdout.expected
+ echo "Merged commit $ccc_commit" >> $testroot/stdout.expected
+ echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
+
+ cmp -s $testroot/stdout.expected $testroot/stdout
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ #diff -u $testroot/stdout.expected $testroot/stdout
+ ret="xfail $(head -n 1 $testroot/stderr)"
+ fi
+ test_done "$testroot" "$ret"
+}
+
test_parseargs "$@"
run_test test_cherrypick_basic
run_test test_cherrypick_root_commit
@@ -789,3 +871,5 @@ run_test test_cherrypick_conflict_wt_file_vs_repo_submodule
run_test test_cherrypick_modified_symlinks
run_test test_cherrypick_symlink_conflicts
run_test test_cherrypick_with_path_prefix_and_empty_tree
+run_test test_cherrypick_conflict_no_eol
+run_test test_cherrypick_conflict_no_eol2