Re: Re: [ANNOUNCE] git-pasky-0.1

Linus Torvalds
2005-04-10T21:37:30Z

On Sun, 10 Apr 2005, Linus Torvalds wrote:
>
> Can you pull my current repo, which has "diff-tree -R" that does what the
> name suggests, and which should be faster than the 0.48 sec you see..

Actually, I changed things around. Everybody hated the "<" ">" lines, so I
put a changed thing on a line of its own with a "*" instead.

So you'd now see lines like

*100644->100644 1874e031abf6631ea51cf6177b82a1e662f6183e->e8181df8499f165cacc6a0d8783be7143013d410 CREDITS

which means that the CREDITS file has changed, and it shows you the mode
-> mode transition (that didn't change in this case) and the sha1 -> sha1
transition.

So now it's always just one line per change. Firthermore, the filename is
always field 3, if you use spaces as delimeters, regardless of whether
it's a +/-/* field.

So let's say you want to merge two trees (dst1 and dst2) from a common
parent (src), what you would do is:

- get the list of files to merge:

diff-tree -R <dst1> <dst2> | tr '\0' '\n' > merge-files

- Which of those were changed by <src> -> <dstX>?

diff-tree -R <src> <dst1> | tr '\0' '\n' | join -j 3 - merge-files > dst1-change
diff-tree -R <src> <dst2> | tr '\0' '\n' | join -j 3 - merge-files > dst2-change

- Which of those are common to both? Let's see what the merge list is:

join dst1-change dst2-change > merge-list

and hopefully you'd usually be working on a very small list of files by
then (everything else you'd just pick from one of the destination trees
directly - you've got the name, the sha-file, everything: no need to even
look at the data).

Does this sound sane? Pasky? Wanna try a "git merge" thing? Starting off
with the user having to tell what the common parent tree is - we can try
to do the "automatically find best common parent" crud later. THAT may be
expensive.

(Btw, this is why I think "diff-tree" is more important than actually
generating the real diff itself - the above uses diff-tree three times
just to cut down to the point where _hopefully_ you don't actually need to
generate very much diffs at all. So I want "diff-tree" to be really fast,
even if it then can take a minute to actually generate a big diff between
releases etc).

Linus