Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: git@vger.kernel.org, Fredrik Kuivinen <freku045@student.liu.se>
Subject: Re: CFT: merge-recursive in C
Date: Mon, 26 Jun 2006 17:25:46 -0700	[thread overview]
Message-ID: <7v4py7h2b9.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20060626233838.GA3121@steel.home> (Alex Riesen's message of "Tue, 27 Jun 2006 01:38:38 +0200")

fork0@t-online.de (Alex Riesen) writes:

> To my deep disappointment, it didn't work out as good as I hoped: one
> program I see most often and for longest time in the process list
> (git-diff-tree) is a too complex thing to be put directly into
> merge-recursive.c, so any help in this direction will be greatly
> appreciated.

Actually, diff-tree is (and to similar degree the internal diff
machinery is) quite reusable as library piece, far more reusable
than other parts of the core git.  If you present what you want
to achieve nicely and ask politely I might even get conned into
helping you interface with the rest of your code ;-).

I am guessing that you want to find out how to do the diff-tree -M
used by the recursive merge without spitting out patch text nor
raw output.  That's quite doable and should be easy.  Most
likely you would use NO_OUTPUT option when you call diff_tree().

First look at builtin-diff.c::builtin_diff_tree() to see how you
can call the diff machinery given two tree object names.  diff_tree()
itself does not emit the diff, but leaves the result in "diff
queue".

After calling diff_tree(), inspect diff_queued_diff() and use
the result to do whatever sensible.  The queue is an array of
diff_filepair that records the (path, sha1, mode) among other
things from old tree and from new tree (the one from the old
tree is called "one", and the new tree is called "two").

So if you have one->path = "old-name.c" and two->path = "new-name.c"
then you see the old-name.c file was renamed to new-name.c

When you are done, do not forget to call diff_flush() to get rid
of queued_diff(); otherwise you would leak.

Have fun.

  parent reply	other threads:[~2006-06-27  0:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 23:38 CFT: merge-recursive in C Alex Riesen
2006-06-26 23:42 ` CFT: merge-recursive in C (test updates) Alex Riesen
2006-06-26 23:54 ` CFT: merge-recursive in C Linus Torvalds
2006-06-27  0:07   ` Linus Torvalds
2006-06-27  0:24     ` Alex Riesen
2006-06-27  0:27       ` Junio C Hamano
2006-06-27  0:17   ` Alex Riesen
2006-06-27  0:25 ` Junio C Hamano [this message]
2006-06-27  0:38   ` Alex Riesen
2006-06-27  7:28   ` Notes on diffcore API Junio C Hamano
2006-06-27  8:41     ` Alex Riesen
2006-06-27 23:33       ` Junio C Hamano
2006-06-28  7:36         ` Johannes Schindelin
2006-06-27  7:52 ` CFT: merge-recursive in C Johannes Schindelin
2006-06-27  8:58   ` Alex Riesen
2006-06-27 10:51     ` Johannes Schindelin
2006-06-27 11:53       ` Alex Riesen
2006-06-27 17:05       ` Junio C Hamano
2006-06-27 12:17 ` Alex Riesen
2006-06-27 12:43   ` Johannes Schindelin
2006-06-27 14:09     ` Alex Riesen
2006-06-28  6:37 ` Uwe Zeisberger
2006-06-28  7:32   ` Alex Riesen
2006-06-28  9:22   ` Junio C Hamano
2006-06-28 15:06 ` Christopher Faylor
2006-06-29  0:38   ` Alex Riesen
2006-06-29  0:49     ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v4py7h2b9.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=freku045@student.liu.se \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox