Skip to content

Commit 6f6e7cf

Browse files
newrengitster
authored andcommitted
t6038: remove problematic test
t6038.11, 'cherry-pick patch from after text=auto' was a test of undefined behavior. To make matters worse, while there are a couple possible correct answers, this test was coded to only check for an obviously incorrect answer. And the final cherry on top is that the test is marked test_expect_failure, meaning it can't provide much value, other than possibly confusing future folks who come along and try to work on attributes and look at existing tests. Because of all these problems, just remove the test. But for any future code spelunkers, here's my understanding of the two possible correct answers: This test was set up so that on a branch with no .gitattributes file, you cherry-picked a patch from a branch that had a .gitattributes file (containing '* text=auto'). Further, the two branches had a file which differed only in line endings. In this situation, correct behavior is not well defined: should the .gitattributes file affect the merge or not? If the .gitattributes file on the other branch should not affect the merge, then we would have a content conflict with all three stages different (the merge base didn't match either side). If the .gitattributes file from the other branch should affect the merge, then we would expect the line endings to be normalized to LF for the version to be recorded in the repository. This would mean that when doing a three-way content merge on the file that differed in line endings, that the three-way content merge would see that the versions on both sides matched and so the cherry-pick has no conflicts and can succeed. The line endings in the file as recorded in the repository will change from CRLF to LF. The version checked out in the working copy will depend on the platform (since there's no eol attribute defined for the file). Also, as a final side note, this test expected an error message that was built assuming cherry-pick was the old scripted version, because cherry-pick no longer uses the error message that was encoded in this test. So it was wrong for yet another reason. Given that the handling of .gitattributes is not well defined and this test was obviously broken and could do nothing but confuse future readers, just remove it. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fe48efb commit 6f6e7cf

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

t/t6038-merge-text-auto.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,6 @@ test_expect_failure 'checkout -m addition of text=auto' '
188188
git diff --no-index --ignore-cr-at-eol expected file
189189
'
190190

191-
test_expect_failure 'cherry-pick patch from after text=auto was added' '
192-
append_cr <<-\EOF >expected &&
193-
first line
194-
same line
195-
EOF
196-
197-
git config merge.renormalize true &&
198-
git rm -fr . &&
199-
git reset --hard b &&
200-
test_must_fail git cherry-pick a >err 2>&1 &&
201-
grep "[Nn]othing added" err &&
202-
compare_files expected file
203-
'
204-
205191
test_expect_success 'Test delete/normalize conflict' '
206192
git checkout -f side &&
207193
git rm -fr . &&

0 commit comments

Comments
 (0)