All of lore.kernel.org
 help / color / mirror / Atom feed
* help understanding git diff output
@ 2011-01-27 22:11 Eugene Sajine
  2011-01-27 23:05 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Eugene Sajine @ 2011-01-27 22:11 UTC (permalink / raw)
  To: git

Hi,

Could you please  help understanding the output of git diff.

I have two branches with this type or relationship:

0-a-b-c-d-e-f-g (branch1)
\a1-a2-a3-b-c-d1-d2-e-f1-f2-g (branch2)

Where commits a1,a2 and a3 as well as other numbered commits in
branch2 are the split version of their counterparts in branch1.
The the branch2 was created by creating the branch2 from branch one
and rebased on 0 with few commits being cplit up during the rebase.

I.e. the resulting state is the same for both branches.

I get empty diff when i execute:

$git diff branch1..branch2

and i also get empty diff when running

$git diff branch2..branch1

What i cannot wrap my mind around is why the command below with
symmetric difference range gives me non-empty diff

$git diff branch1...branch2

Please, advise

Thanks a lot,
Eugene

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: help understanding git diff output
  2011-01-27 22:11 help understanding git diff output Eugene Sajine
@ 2011-01-27 23:05 ` Junio C Hamano
  2011-01-27 23:23   ` Eugene Sajine
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2011-01-27 23:05 UTC (permalink / raw)
  To: Eugene Sajine; +Cc: git

Eugene Sajine <euguess@gmail.com> writes:

> I get empty diff when i execute:
>
> $git diff branch1..branch2
>
> and i also get empty diff when running
>
> $git diff branch2..branch1

The thing is, "diff" is about comparing "two endpoints".

We still do support, as a backward compatibility measure, the A..B
notation to help people who learned "git diff" from ancient documents, and
we don't plan to deprecate the notation in any way, but don't be fooled by
the notation which usually means "the range from A to B".  In the context
of diff, it does not mean a range, as diff is about two "endpoints".

> What i cannot wrap my mind around is why the command below with
> symmetric difference range gives me non-empty diff
>
> $git diff branch1...branch2

"git diff A...B" is a short-hand for "git diff $(git merge-base A B) B",
naming the fork point between branches A and B as one end, and B as the
other end, of the diff.  Again, diff is about two "endpoints", and the
notation does not mean a symmetric difference range.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: help understanding git diff output
  2011-01-27 23:05 ` Junio C Hamano
@ 2011-01-27 23:23   ` Eugene Sajine
  0 siblings, 0 replies; 3+ messages in thread
From: Eugene Sajine @ 2011-01-27 23:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, Jan 27, 2011 at 6:05 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Eugene Sajine <euguess@gmail.com> writes:
>
>> I get empty diff when i execute:
>>
>> $git diff branch1..branch2
>>
>> and i also get empty diff when running
>>
>> $git diff branch2..branch1
>
> The thing is, "diff" is about comparing "two endpoints".
>
> We still do support, as a backward compatibility measure, the A..B
> notation to help people who learned "git diff" from ancient documents, and
> we don't plan to deprecate the notation in any way, but don't be fooled by
> the notation which usually means "the range from A to B".  In the context
> of diff, it does not mean a range, as diff is about two "endpoints".
>
>> What i cannot wrap my mind around is why the command below with
>> symmetric difference range gives me non-empty diff
>>
>> $git diff branch1...branch2
>
> "git diff A...B" is a short-hand for "git diff $(git merge-base A B) B",
> naming the fork point between branches A and B as one end, and B as the
> other end, of the diff.  Again, diff is about two "endpoints", and the
> notation does not mean a symmetric difference range.
>
>
>

Thanks a lot, Junio. I was looking at the wrong place in the
documentation. Skipped the part in diff doc explaining that range
notations are not exactly ranges for diff.

Thanks,
Eugene

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-27 23:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 22:11 help understanding git diff output Eugene Sajine
2011-01-27 23:05 ` Junio C Hamano
2011-01-27 23:23   ` Eugene Sajine

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.