In Documentation/diff-format.txt we can find the following information about
combined diff format:
combined diff format
--------------------
git-diff-tree and git-diff-files can take '-c' or '--cc' option
to produce 'combined diff', which looks like this:
------------
diff --combined describe.c
@@@ +98,7 @@@
return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
}
- static void describe(char *arg)
-static void describe(struct commit *cmit, int last_one)
++static void describe(char *arg, int last_one)
{
+ unsigned char sha1[20];
+ struct commit *cmit;
------------
And it further goes how to read combined diff format, and how --cc
(condensed combined) differs from --combined.
There is no note about which of extended headers functions with combined
diff format, how they change, how chunk header changes.
From what I gathered, there are the following differences as compared to
ordinary (diff --git) git extended headers:
1. "git diff" header which looked like this
diff --git a/file1 b/file2
is now
diff --combined file2
(where instead of --combined we might have --cc). Not described in
documentation.
2. the "index" extended header line changes from
index <hash>..<hash> <mode>
to
index <hash>,<hash>..<hash>
Mode information is put in separate line, only if mode changes, for
example
mode <mode>,<mode>..<mode>
<mode> can be 000000 if file didn't exist in particular parent; if file
was cerated by merge we have
new file mode <mode>
I haven't checked what happens if file is deleted, either by branch or by
merge commit itself. Not described in documentation, I'm not sure about
how this (wrt modes) works.
3. The "rename/copy" headers seems to be never present; see below.
4. From file/to file header _seems_ to function exactly like in ordinary
diff format, namely
--- a/file1
+++ b/file2
But it seems to ...Thanks for starting this. Your observation is correct. It was pretty much designed for quick _content_ inspection and renames would work correctly to pick which blobs from each tree to compare but otherwise not reflected in the output (the pathnames are not shown as far as I know). We could probably add it if Correct. This was done to prevent people from accidentally feeding it to "patch -p1". In other words, we wanted to make it so obvious that it is _not_ a patch. There may be more information in "git log -- combine-diff.c" output that ought to be collected into the documentation, and now might be a good time to do so, given that that part of the system is fairly stable and has not changed for quite some time If you mean by "hunk section indicator" the output similar to GNU diff -p option, I think it is not worth mentioning and we are not ready to mention it yet (we have not etched the expression in stone). Nobody jumped up and down to say it needs to be configurable, so it is left undocumented more or less But you already know the answer to that question, since you asked me a few days ago ;-). Patches to documentation would be easier to comment on and more Yes. I do not see anything obviously unexpected in your output. -
It isn't, really... perhaps it should be made /more/ obvious (not use @ but e.g. &, ...)? -- Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 2654431 Universidad Tecnica Federico Santa Maria +56 32 2654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 2797513 -
Eh, sorry, what I meant was "obvious to the tool", so "patch" would take notice. -
Update example combined diff format to the current version $ git diff-tree -p -c fec9ebf16c948bcb4a8b88d0173ee63584bcde76 and provide complete first chunk in example. Document combined diff format headers: how "diff header" look like, which of "extended diff headers" are used with combined diff and how they look like, differences in two-line from-file/to-file header from non-combined diff format, chunk header format. It should be noted that combined diff format was designed for quick _content_ inspection and renames would work correctly to pick which blobs from each tree to compare but otherwise not reflected in the output (the pathnames are not shown). Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- Junio C Hamano napisa
Thanks. I guess review by the original author would be good enough; this is entirely my code -- it was done while Linus and gang I've done minimal asciidoc mark-up fixes. Troff man output look horrible but that is not limited to this man page -- it looks quite wrong whenever numbered list with displayed examples are used. -
