On Fri, Jan 22, 2016 at 06:01:25PM +0100, Johannes Schindelin wrote:
> When merging files in repos with core.eol = crlf, git merge-file inserts
> just a LF at the end of the merge markers. Files with mixed line endings
> cause trouble in Windows editors and e.g. contrib/git-jump, where an
> unmerged file in a run of "git jump merge" is reported as simply "binary
> file matches".
> [...]
> Signed-off-by: Beat Bolli <dev+...@drbeat.li>
> Signed-off-by: Jeff King <p...@peff.net>
> Signed-off-by: Johannes Schindelin <johannes.schinde...@gmx.de>
> ---
> diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
> @@ -346,4 +346,18 @@ test_expect_success 'conflict at EOF without LF resolved 
> by --union' \
> +test_expect_success 'conflict markers contain CRLF when core.eol=crlf' '
> +     test_must_fail git -c core.eol=crlf merge-file -p \
> +             nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
> +     test $(sed -n "/\.txt\r$/p" output.txt | wc -l) = 3

The "\r" isn't recognized by 'sed' on Mac OS X or BSD. Perhaps use
instead:

    test $(cat output.txt | tr "\015" Q | sed -n "/\.txtQ$/p" | wc -l) = 3

which works on Linux, Mac OS X, and BSD (in my tests).

Or, implement a cr_to_q() to complement the existing q_to_cr() in
t/test-lib-functions.sh.

> +'
> +
> +test_expect_success 'conflict markers heed gitattributes over core.eol=crlf' 
> '
> +     git config core.eol crlf &&
> +     echo "*.txt eol=lf" >>.gitattributes &&
> +     test_must_fail git -c core.eol=crlf merge-file -p \
> +             nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
> +     test $(sed -n "/\.txt\r$/p" output.txt | wc -l) = 0

Ditto.

> +'
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to