/*
* Recursive Merge algorithm stolen from git-merge-recursive.py by
* Fredrik Kuivinen.
* The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
*/
#include "advice.h"
#include "cache.h"
#include "cache-tree.h"
#include "commit.h"
#include "blob.h"
#include "builtin.h"
#include "tree-walk.h"
#include "diff.h"
#include "diffcore.h"
#include "tag.h"
#include "unpack-trees.h"
#include "string-list.h"
#include "xdiff-interface.h"
#include "ll-merge.h"
#include "attr.h"
#include "merge-recursive.h"
#include "dir.h"
static struct tree *shift_tree_object(struct tree *one, struct tree *two,
const char *subtree_shift)
{
unsigned char shifted[20];
if (!*subtree_shift) {
shift_tree(one->object.sha1, two->object.sha1, shifted, 0);
} else {
shift_tree_by(one->object.sha1, two->object.sha1, shifted,
subtree_shift);
}
if (!hashcmp(two->object.sha1, shifted))
return two;
return lookup_tree(shifted);
}
/*
* A virtual commit has (const char *)commit->util set to the name.
*/
static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
{
struct commit *commit = xcalloc(1, sizeof(struct commit));
commit->tree = tree;
commit->util = (void*)comment;
/* avoid warnings */
commit->object.parsed = 1;
return commit;
}
/*
* Since we use get_tree_entry(), which does not put the read object into
* the object pool, we cannot rely on a == b.
*/
static int sha_eq(const unsigned char *a, const unsigned char *b)
{
if (!a && !b)
return 2;
return a && b && hashcmp(a, b) == 0;
}
/*
* Since we want to write the index eventually, we cannot reuse the index
* for these (temporary) data.
*/
struct stage_data
{
struct
{
unsigned mode;
unsigned char sha[20];
} stages[4];
unsigned processed:1;
};
static int show(struct merge_options *o, int v)
|