Re: Strange behaviour of git diff branch1 ... branch2
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Oct 27, 2012, 03:51 UTC
- Message-ID
- <CACsJy8CX4Wbf3Bqez2kcQ7NGYMkqXC8MK+=hrH4iaev+0ZrQ8Q@mail.gmail.com>
- In-Reply-To
- <20121026212650.GB2612@pug.qqx.org>
On Sat, Oct 27, 2012 at 4:26 AM, Aaron Schrab <aaron@schrab.com> wrote:
Show 12 quoted lines
> I came across this odd question on stackoverflow: > http://stackoverflow.com/q/13092854/1507392 > > > If git diff is run with "..." as a separate argument between two commit-ish > arguments causes it to produce strange output. The differences seem to be > the same as if "..." was left out, but change lines begin with 4 + or - > characters rather than just 1. > > Can anybody explain what is happening here? I don't have any reason to want > to use that form myself, but I'm very curious about why it produces this odd > output.
I'm curious too. It shows this to me
diff --cc .gitignore index a188a82,a188a82,a188a82,a188a82..d4473d8
--- a/.gitignore +++ b/.gitignore @@@@@ -2,9 -2,9 -2,9 -2,9 +2,6 @@@@@ /GIT-CFLAGS /GIT-LDFLAGS /GIT-GUI-VARS ----/GIT-PREFIX ----/GIT-SCRIPT-DEFINES ----/GIT-USER-AGENT /GIT-VERSION-FILE /bin-wrappers/ /git Notice the --cc in the first line, which is combined diff. Usually combined-diff is between two points and one parent. Though somehow git passes 4 parents down combined-diff.c:show_combined_header, as you can see in the "index" line. I think we should fix rev parsing code as it does not make sense to pass 4 identical parents this way.
-- Duy