* Fwd: diff not finding difference
[not found] <CAKepmajSPgGK-DqR3Bxf2Xqxj2Gz0MazRNxM6wsVcSiBQsoE4Q@mail.gmail.com>
@ 2015-09-24 21:09 ` Jack Adrian Zappa
2015-09-24 21:12 ` Jack Adrian Zappa
2015-09-25 10:11 ` Fwd: " Johannes Schindelin
0 siblings, 2 replies; 4+ messages in thread
From: Jack Adrian Zappa @ 2015-09-24 21:09 UTC (permalink / raw)
To: git-mailing-list
This is a weird one:
[file-1 begin]
abcd efg hijklmnop
[file-1 end]
[file-2 begin]
blah blah blah
/////////////////////////////////////////////////////////////////////////////////
abdc boo ya!
[file-2 end]
Do a diff between these and it won't find any difference.
Same with the following two lines, each in a different file:
sabc fed ghi jkl
abc def ghi jkl
I first noticed this on the command line git and then in VS2013. The
original problem was like my first example. The files were much
longer, but all that git would see is the addition of the line of
////..., but not the removal of the original line.
I've tried some other simple file changes with similar results.
Something seems to be definitely broken in git diff. :(
Command line version of git is 1.9.5 msysgit.0.
A
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: diff not finding difference
2015-09-24 21:09 ` Fwd: diff not finding difference Jack Adrian Zappa
@ 2015-09-24 21:12 ` Jack Adrian Zappa
2015-09-25 10:11 ` Fwd: " Johannes Schindelin
1 sibling, 0 replies; 4+ messages in thread
From: Jack Adrian Zappa @ 2015-09-24 21:12 UTC (permalink / raw)
To: git-mailing-list
On Thu, Sep 24, 2015 at 5:09 PM, Jack Adrian Zappa
<adrianh.bsc@gmail.com> wrote:
> This is a weird one:
>
> [file-1 begin]
>
> abcd efg hijklmnop
>
> [file-1 end]
>
> [file-2 begin]
>
> blah blah blah
> /////////////////////////////////////////////////////////////////////////////////
> abdc boo ya!
>
> [file-2 end]
>
> Do a diff between these and it won't find any difference.
>
> Same with the following two lines, each in a different file:
> sabc fed ghi jkl
> abc def ghi jkl
>
> I first noticed this on the command line git and then in VS2013. The
> original problem was like my first example. The files were much
> longer, but all that git would see is the addition of the line of
> ////..., but not the removal of the original line.
>
> I've tried some other simple file changes with similar results.
> Something seems to be definitely broken in git diff. :(
>
> Command line version of git is 1.9.5 msysgit.0.
>
>
> A
BTW, I've upgraded to git version 2.5.3.windows.1 and the problem
still persists.
A
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fwd: diff not finding difference
2015-09-24 21:09 ` Fwd: diff not finding difference Jack Adrian Zappa
2015-09-24 21:12 ` Jack Adrian Zappa
@ 2015-09-25 10:11 ` Johannes Schindelin
2015-09-25 10:25 ` Michael J Gruber
1 sibling, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2015-09-25 10:11 UTC (permalink / raw)
To: Jack Adrian Zappa; +Cc: git-mailing-list
Hi Jack Adrian,
On 2015-09-24 23:09, Jack Adrian Zappa wrote:
> This is a weird one:
>
> [file-1 begin]
>
> abcd efg hijklmnop
>
> [file-1 end]
>
> [file-2 begin]
>
> blah blah blah
> /////////////////////////////////////////////////////////////////////////////////
> abdc boo ya!
>
> [file-2 end]
>
> Do a diff between these and it won't find any difference.
>
> Same with the following two lines, each in a different file:
> sabc fed ghi jkl
> abc def ghi jkl
>
> I first noticed this on the command line git and then in VS2013. The
> original problem was like my first example. The files were much
> longer, but all that git would see is the addition of the line of
> ////..., but not the removal of the original line.
>
> I've tried some other simple file changes with similar results.
> Something seems to be definitely broken in git diff. :(
You might want to show your exact command-line invocation, i.e. the full information. I suspect that you missed the fact that `git diff a b` does not compare the file a to the file b, but instead it compares both a and b to what is recorded in the index. With one quirk: if the files a and b are not even recorded in the index, `git diff` will output nothing.
Now, the really confusing part for you was probably that your `file-2` *was* recorded in the index (maybe you made a backup copy with the extra file extension `.bak` or some such, and then called `git diff my-file.bak my-file` where `my-file` *actually is tracked by Git* but `my-file.bak` is not).
But `git diff` has so nice features that I wanted to use it myself to compare files or directories. That is why I introduced the `--no-index` option, years ago. And so I suspect that you called
git diff file-1 file-2
when you actually wanted to call
git diff --no-index file-1 file-2
Here is my shell session to verify that `git diff` works as designed:
```
me@work $ cat >file-1
abcd efg hijklmnop
me@work $ cat >file-2
blah blah blah
/////////////////////////////////////////////////////////////////////////////////
abdc boo ya!
me@work $ git diff --no-index file-1 file-2
diff --git a/file-1 b/file-2
index 80ea2bc..f7fd7eb 100644
--- a/file-1
+++ b/file-2
@@ -1,3 +1,5 @@
-abcd efg hijklmnop
+blah blah blah
+/////////////////////////////////////////////////////////////////////////////////
+abdc boo ya!
me@work $
```
Please note that I ended the file contents for both `cat` calls [*1*] with a `Ctrl+D` which you cannot see in the pasted lines.
Ciao,
Johannes
Footnote *1*: Can you believe that I wanted to make that pun for at least ten years now?
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Fwd: diff not finding difference
2015-09-25 10:11 ` Fwd: " Johannes Schindelin
@ 2015-09-25 10:25 ` Michael J Gruber
0 siblings, 0 replies; 4+ messages in thread
From: Michael J Gruber @ 2015-09-25 10:25 UTC (permalink / raw)
To: Johannes Schindelin, Jack Adrian Zappa; +Cc: git-mailing-list
Johannes Schindelin venit, vidit, dixit 25.09.2015 12:11:
> Hi Jack Adrian,
>
> On 2015-09-24 23:09, Jack Adrian Zappa wrote:
>> This is a weird one:
>>
>> [file-1 begin]
>>
>> abcd efg hijklmnop
>>
>> [file-1 end]
>>
>> [file-2 begin]
>>
>> blah blah blah
>> /////////////////////////////////////////////////////////////////////////////////
>>
>>
abdc boo ya!
>>
>> [file-2 end]
>>
>> Do a diff between these and it won't find any difference.
>>
>> Same with the following two lines, each in a different file: sabc
>> fed ghi jkl abc def ghi jkl
>>
>> I first noticed this on the command line git and then in VS2013.
>> The original problem was like my first example. The files were
>> much longer, but all that git would see is the addition of the line
>> of ////..., but not the removal of the original line.
>>
>> I've tried some other simple file changes with similar results.
>> Something seems to be definitely broken in git diff. :(
>
> You might want to show your exact command-line invocation, i.e. the
> full information. I suspect that you missed the fact that `git diff a
> b` does not compare the file a to the file b, but instead it compares
> both a and b to what is recorded in the index. With one quirk: if the
> files a and b are not even recorded in the index, `git diff` will
> output nothing.
>
> Now, the really confusing part for you was probably that your
> `file-2` *was* recorded in the index (maybe you made a backup copy
> with the extra file extension `.bak` or some such, and then called
> `git diff my-file.bak my-file` where `my-file` *actually is tracked
> by Git* but `my-file.bak` is not).
>
> But `git diff` has so nice features that I wanted to use it myself to
> compare files or directories. That is why I introduced the
> `--no-index` option, years ago. And so I suspect that you called
Ah, now is a good time to rename my (shell) alias "gdiff" for "git diff
--no-index" to dschodiff.
Thanks, Dscho :)
Michael
P.S.: Note that dschodiff works perfectly even outside a git working
directory, with all the --color-words and whitespace goodness and what not!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-25 10:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAKepmajSPgGK-DqR3Bxf2Xqxj2Gz0MazRNxM6wsVcSiBQsoE4Q@mail.gmail.com>
2015-09-24 21:09 ` Fwd: diff not finding difference Jack Adrian Zappa
2015-09-24 21:12 ` Jack Adrian Zappa
2015-09-25 10:11 ` Fwd: " Johannes Schindelin
2015-09-25 10:25 ` Michael J Gruber
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).