git diff --word-diff problem
- From
- Ivan Shirokoff <shirokoff@yandex-team.ru>
- Date
- Jan 12, 2012, 09:05 UTC
- Message-ID
- <4F0EA23D.3010603@yandex-team.ru>
Hello. I've got a couple of generated files with obfuscated code. I want to word-diff them just to make sure that everything is right.
The thing is when word-diff gets oneline file without newline at the end it compares it with regular line by line diff.
Here is an example. Two one line files generated with perl -e "print 'a 'x10" > file
git diff --word-diff=plain file1 file2
diff --git a/file1 b/file2 index 3526254..0515a63 100644 --- a/file1 +++ b/file2 @@ -1 +1 @@ [- a a a a a a a a a a-] No newline at end of file {+a a a a a ab a a a a+} Git shows that the whole line is different. And if I add newlines to that files everything works just as expected git diff --word-diff=plain file1 file2 diff --git a/file1 b/file2 index 1756d83..1ec45b9 100644 --- a/file1 +++ b/file2 @@ -1,2 +1,2 @@ a a a a a [-a -]{+ab +}a a a a Is that a bug or I've missed explanation in docs?
-- Ivan Shirokoff