zsf222
zsf222

Reputation: 401

git diff: many patches with three '@' symbol

I am writing an automatic tool based on git show, which relies on git diff command. I wrote a small parser which takes the output of git show as the text to parse, and in most situations in the result the lines start with '@@' indicates which lines it will compare.

However, I met an situation like this:

@@@ -460,22 -415,8 +460,22 @@@

What does that mean? Is it possible that there will be even more (4 or more) '@' symbols with even more subtle meanings?

Upvotes: 0

Views: 164

Answers (2)

Vampire
Vampire

Reputation: 38669

You are showing a merge in combined diff format. If you look at the man-page of git show, it has a complete section about combined diff format, when it is used and how it looks like. Also in the initial description of git show it says that merges will be shown like git diff-tree --cc which also refers to the combined diff format.

And yes, there can be more than three @ symbols. There will be one per parent commit + 1. So if you have a merge with three parents (a so-called octupus merge), there will be four at signs. If you have four parents, there will be five at signs and so on.

Upvotes: 1

Mark Adelsberger
Mark Adelsberger

Reputation: 45689

It looks to me like you're doing a show on a merge, and this hunk differs from both parents; could that be the explanation?

Upvotes: 1

Related Questions