git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-diff-files -z output
@ 2005-05-22 17:05 Thomas Glanzmann
  2005-05-22 17:17 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Glanzmann @ 2005-05-22 17:05 UTC (permalink / raw)
  To: GIT

Hello,
is this correct?

(faui00u) [~/work/git/yagf] git-diff-files -z | xxd
0000000: 3a31 3030 3634 3420 3030 3030 3030 2031  :100644 000000 1
0000010: 6663 3834 3639 6366 6332 6631 3436 3332  fc8469cfc2f14632
0000020: 3734 3333 3363 3062 6562 6162 3065 3465  74333c0bebab0e4e
0000030: 3439 3562 6336 6220 3030 3030 3030 3030  495bc6b 00000000
0000040: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
0000050: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
0000060: 0064 6966 662e 6800 6469 6666 2e68 003a  .diff.h.diff.h.:
0000070: 3130 3037 3535 2031 3030 3735 3520 6464  100755 100755 dd
0000080: 3633 6533 3535 3463 3137 6431 3861 3039  63e3554c17d18a09
0000090: 3137 3931 3038 3264 3164 3632 3864 3835  1791082d1d628d85
00000a0: 3162 3933 3038 2030 3030 3030 3030 3030  1b9308 000000000
00000b0: 3030 3030 3030 3030 3030 3030 3030 3030  0000000000000000
00000c0: 3030 3030 3030 3030 3030 3030 3030 3000  000000000000000.
00000d0: 6769 7400 6769 7400                      git.git.

Eg the fields are seperated by space/tab and only the filenames by \0?

I am adopting to the new format.

Are the fields supposed to be seperated by space or tab?

static void diff_flush_raw(struct diff_filepair *p)
{
        /*
         * We used to reject rename/copy but new diff-raw can express them.
         */
        printf(":%06o %06o %s ",
               p->one->mode, p->two->mode, sha1_to_hex(p->one->sha1));
        printf("%s%c%s%c%s%c",
               sha1_to_hex(p->two->sha1), inter_name_termination,
               p->one->path, inter_name_termination,
               p->two->path, line_termination);
}


Gruesse,
	Thomas

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

* Re: git-diff-files -z output
  2005-05-22 17:05 git-diff-files -z output Thomas Glanzmann
@ 2005-05-22 17:17 ` Junio C Hamano
  2005-05-22 17:27   ` Thomas Glanzmann
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2005-05-22 17:17 UTC (permalink / raw)
  To: GIT

>>>>> "TG" == Thomas Glanzmann <sithglan@stud.uni-erlangen.de> writes:

TG> I am adopting to the new format.
TG> Are the fields supposed to be seperated by space or tab?

Please see Documentation/diff-format.txt; find the below in the
archive for the full description of why we wanted this format
update.

    From:	Junio C Hamano <junkio@cox.net>
    Subject: Re: updated design for the diff-raw format.
    To:	git@vger.kernel.org
    Date:	Sat, 21 May 2005 16:17:33 -0700

    (second of the replayed message, with blessing from Linus)

    Date: Sat, 21 May 2005 11:24:31 -0700 (PDT)
    From: Linus Torvalds <torvalds@osdl.org>
    To: Junio C Hamano <junkio@cox.net>
    Subject: Re: [PATCH 3/3] Diff overhaul, adding the other half of copy detection.
    Message-ID: <Pine.LNX.4.58.0505211107160.2206@ppc970.osdl.org>

    On Sat, 21 May 2005, Junio C Hamano wrote:
    > 
    > Once we start to think of it this way, it becomes quite tempting
    > to change the diff-raw format to actually match the above
    > concept.

    I agree, and I was going to suggest changing the "raw" diff output for all
    the same reasons. So I think you should do it, as the old format was based
    on not really knowing where this all would take us. I think your proposed
    format is visually nicer, and it's obviously more flexible.



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

* Re: git-diff-files -z output
  2005-05-22 17:17 ` Junio C Hamano
@ 2005-05-22 17:27   ` Thomas Glanzmann
  2005-05-22 17:32     ` Thomas Glanzmann
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Glanzmann @ 2005-05-22 17:27 UTC (permalink / raw)
  To: GIT

Hello,

> Please see Documentation/diff-format.txt; find the below in the
> archive for the full description of why we wanted this format
> update.

got it thanks. I read that eMail before. But I thought that the
tab -> space was a mistake, but it wasn't. So I am fine. I use the
following code fragment to match it. Gitweb and co have to be adopted as
well:

sub
process_git_diff_output
{
        my $str = shift || die("Need Input");

        my @in  = split("\0", $str);
        my @out = ();

        while (@in) {
                my @tmp = split(' ', shift(@in));
                push(@tmp, shift(@in), shift(@in));
                push(@out, [@tmp]);
        }

        return(@out);
}

	Thomas

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

* Re: git-diff-files -z output
  2005-05-22 17:27   ` Thomas Glanzmann
@ 2005-05-22 17:32     ` Thomas Glanzmann
  2005-05-22 17:38       ` Thomas Glanzmann
  2005-05-22 17:49       ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Glanzmann @ 2005-05-22 17:32 UTC (permalink / raw)
  To: GIT

Hello,
this is better (it strips the colon from the first mode):

sub
process_git_diff_output
{
        my $str = shift || die("Need Input");

        my @in  = split("\0", $str);
        my @out = ();

        while (@in) {
                my @tmp = split(' ', shift(@in));
                $tmp[0] =~ s/^://g;
                push(@tmp, shift(@in), shift(@in));
                push(@out, [@tmp]);
        }

        return(@out);
}

	Thomas

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

* Re: git-diff-files -z output
  2005-05-22 17:32     ` Thomas Glanzmann
@ 2005-05-22 17:38       ` Thomas Glanzmann
  2005-05-22 17:49       ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Glanzmann @ 2005-05-22 17:38 UTC (permalink / raw)
  To: GIT

Hello,

>                 $tmp[0] =~ s/^://g;
                                   ^ -> This is useless.

	Thomas

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

* Re: git-diff-files -z output
  2005-05-22 17:32     ` Thomas Glanzmann
  2005-05-22 17:38       ` Thomas Glanzmann
@ 2005-05-22 17:49       ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2005-05-22 17:49 UTC (permalink / raw)
  To: GIT

>>>>> "TG" == Thomas Glanzmann <sithglan@stud.uni-erlangen.de> writes:

I do not do Porcelain, but...

TG> this is better (it strips the colon from the first mode):

I think you are also stripping the colon at the beginning of the
filename if I am not mistaken.  Also posting only this part is
not very useful because I cannot tell what parameter this sub is
being fed.  I am presuming that you are either feeding a single
line from DIFF_FORMAT_HUMAN format output, or three lines
(unless dealing with 'U' entry in which case you have to do only
a single line) from DIFF_FORMAT_MACHINE format output.  When in
doubt, seeing what diff-helper does would help.


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

end of thread, other threads:[~2005-05-22 17:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-22 17:05 git-diff-files -z output Thomas Glanzmann
2005-05-22 17:17 ` Junio C Hamano
2005-05-22 17:27   ` Thomas Glanzmann
2005-05-22 17:32     ` Thomas Glanzmann
2005-05-22 17:38       ` Thomas Glanzmann
2005-05-22 17:49       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).