git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] blame: add a failing test for a CRLF issue.
Date: Wed, 19 Feb 2014 21:16:22 +0100	[thread overview]
Message-ID: <53051116.5010307@web.de> (raw)
In-Reply-To: <1392752735-168203-1-git-send-email-sandals@crustytoothpaste.net>

On 02/18/2014 08:45 PM, brian m. carlson wrote:
> If a file contains CRLF line endings in a repository with
> core.autocrlf=input, then blame always marks the lines as "Not Committed
> Yet", even if they are unmodified.  Add a failing test for this case, so we
> are at least aware of this issue.
>
> Reported-by: Ephrim Khong <dr.khong@gmail.com>
> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> ---
>
> Obviously, this doesn't actually fix the issue, but at least we're aware of it
> so we don't lose track of it and can fix it.  A future patch can mark the test
> passing.
>
>   t/t8003-blame-corner-cases.sh | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
> index e7cac1d..903f775 100755
> --- a/t/t8003-blame-corner-cases.sh
> +++ b/t/t8003-blame-corner-cases.sh
> @@ -191,4 +191,14 @@ test_expect_success 'indent of line numbers, ten lines' '
>   	test $(grep -c "  " actual) = 9
>   '
>
> +test_expect_failure 'blaming files with CRLF newlines' '
> +	git config core.autocrlf false &&
> +	printf "testcase\r\n" >crlffile &&
> +	git add crlffile &&
> +	git commit -m testcase &&
> +	git config core.autocrlf input &&
> +	git blame crlffile >actual &&
> +	grep "A U Thor" actual
> +'
> +
>   test_done
>

We can test that git blame gives the same result with 
core.autocrlf=input  and core.autocrlf=false, and make the test case 
look like this:

test_expect_failure 'blaming files with CRLF newlines' '
	git config core.autocrlf false &&
	printf "testcase\r\n" >crlffile &&
	git add crlffile &&
	git commit -m testcase &&
	git blame crlffile >expected &&
	git -c core.autocrlf=input blame crlffile >actual &&
	test_cmp expected actual
'

      reply	other threads:[~2014-02-19 20:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  9:08 git blame: "Not Committed Yet" with clean WD Ephrim Khong
2014-02-14 19:10 ` brian m. carlson
2014-02-18 19:45   ` [PATCH] blame: add a failing test for a CRLF issue brian m. carlson
2014-02-19 20:16     ` Torsten Bögershausen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53051116.5010307@web.de \
    --to=tboegi@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).