Re: Combined diff format documentation

Previous thread: Re: [PATCH] document the <tree ish> <file> blob reference syntax by Jakub Narebski on Wednesday, October 25, 2006 - 1:04 pm. (1 message)

Next thread: Re: VCS comparison table by Jakub Narebski on Wednesday, October 25, 2006 - 3:29 pm. (3 messages)
From: Jakub Narebski
Date: Wednesday, October 25, 2006 - 3:22 pm

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 &gt; 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. &quot;git diff&quot; 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 &quot;index&quot; extended header line changes from

     index &lt;hash&gt;..&lt;hash&gt; &lt;mode&gt;

   to
   
     index &lt;hash&gt;,&lt;hash&gt;..&lt;hash&gt;

   Mode information is put in separate line, only if mode changes, for
   example

     mode &lt;mode&gt;,&lt;mode&gt;..&lt;mode&gt;

   &lt;mode&gt; can be 000000 if file didn't exist in particular parent; if file
   was cerated by merge we have

     new file mode &lt;mode&gt;

   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 &quot;rename/copy&quot; 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 ...
From: Junio C Hamano
Date: Wednesday, October 25, 2006 - 3:40 pm

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 &quot;patch -p1&quot;.  In other words, we wanted to make it
so obvious that it is _not_ a patch.

There may be more information in &quot;git log -- combine-diff.c&quot;
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 &quot;hunk section indicator&quot; 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.


-

From: Horst H. von Brand
Date: Wednesday, October 25, 2006 - 6:48 pm

It isn't, really... perhaps it should be made /more/ obvious (not use @ but
e.g. &amp;, ...)?
-- 
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
-

From: Junio C Hamano
Date: Wednesday, October 25, 2006 - 8:04 pm

Eh, sorry, what I meant was &quot;obvious to the tool&quot;, so &quot;patch&quot;
would take notice.

-

From: Jakub Narebski
Date: Wednesday, October 25, 2006 - 8:44 pm

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 &quot;diff header&quot; look like,
which of &quot;extended diff headers&quot; 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 &lt;jnareb@gmail.com&gt;
---
Junio C Hamano napisa
From: Junio C Hamano
Date: Wednesday, October 25, 2006 - 11:15 pm

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.

-

Previous thread: Re: [PATCH] document the <tree ish> <file> blob reference syntax by Jakub Narebski on Wednesday, October 25, 2006 - 1:04 pm. (1 message)

Next thread: Re: VCS comparison table by Jakub Narebski on Wednesday, October 25, 2006 - 3:29 pm. (3 messages)