* git blame: "Not Committed Yet" with clean WD
@ 2014-02-13 9:08 Ephrim Khong
2014-02-14 19:10 ` brian m. carlson
0 siblings, 1 reply; 4+ messages in thread
From: Ephrim Khong @ 2014-02-13 9:08 UTC (permalink / raw)
To: git
Hi,
for files that contain windows line endings in a repository with
core.autocrlf=input, git blame will show lines as "Not Committed Yet",
even though they were not modified.
Example:
--
git init
git config core.autocrlf false
echo "foo" > a
unix2dos a
git add a
git commit -m "initial commit"
git config core.autocrlf input
git status
git blame a
--
Output:
--
Reinitialized existing Git repository in /.../testblame2/.git/
unix2dos: converting file a to DOS format ...
On branch master
nothing to commit, working directory clean
On branch master
nothing to commit, working directory clean
00000000 (Not Committed Yet 2014-02-13 10:02:43 +0100 1) foo
--
Is there an easy way to work around this; is this desired behaviour or
mor a bug?
Thanks - Eph
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git blame: "Not Committed Yet" with clean WD
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
0 siblings, 1 reply; 4+ messages in thread
From: brian m. carlson @ 2014-02-14 19:10 UTC (permalink / raw)
To: Ephrim Khong; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]
On Thu, Feb 13, 2014 at 10:08:55AM +0100, Ephrim Khong wrote:
> Hi,
>
> for files that contain windows line endings in a repository with
> core.autocrlf=input, git blame will show lines as "Not Committed
> Yet", even though they were not modified.
>
> Example:
>
> --
> git init
> git config core.autocrlf false
> echo "foo" > a
> unix2dos a
> git add a
> git commit -m "initial commit"
> git config core.autocrlf input
> git status
> git blame a
> --
>
> Output:
>
> --
> Reinitialized existing Git repository in /.../testblame2/.git/
> unix2dos: converting file a to DOS format ...
> On branch master
> nothing to commit, working directory clean
> On branch master
> nothing to commit, working directory clean
> 00000000 (Not Committed Yet 2014-02-13 10:02:43 +0100 1) foo
> --
>
> Is there an easy way to work around this; is this desired behaviour
> or mor a bug?
I'm pretty sure this is a bug. git blame should show the proper
information in this case.
--
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] blame: add a failing test for a CRLF issue.
2014-02-14 19:10 ` brian m. carlson
@ 2014-02-18 19:45 ` brian m. carlson
2014-02-19 20:16 ` Torsten Bögershausen
0 siblings, 1 reply; 4+ messages in thread
From: brian m. carlson @ 2014-02-18 19:45 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
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
--
1.9.0.rc3.1008.gd08b47c.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] blame: add a failing test for a CRLF issue.
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
0 siblings, 0 replies; 4+ messages in thread
From: Torsten Bögershausen @ 2014-02-19 20:16 UTC (permalink / raw)
To: brian m. carlson; +Cc: git, Junio C Hamano
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
'
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-19 20:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.