* The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
*/
#include "cache.h"
-#include "config.h"
+#include "merge-recursive.h"
+
#include "advice.h"
-#include "lockfile.h"
-#include "cache-tree.h"
-#include "object-store.h"
-#include "repository.h"
-#include "commit.h"
+#include "alloc.h"
+#include "attr.h"
#include "blob.h"
#include "builtin.h"
-#include "tree-walk.h"
+#include "cache-tree.h"
+#include "commit.h"
+#include "commit-reach.h"
+#include "config.h"
#include "diff.h"
#include "diffcore.h"
+#include "dir.h"
+#include "ll-merge.h"
+#include "lockfile.h"
+#include "object-store.h"
+#include "repository.h"
+#include "revision.h"
+#include "string-list.h"
+#include "submodule.h"
#include "tag.h"
-#include "alloc.h"
+#include "tree-walk.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"
-#include "submodule.h"
-#include "revision.h"
-#include "commit-reach.h"
struct merge_options_internal {
int call_depth;
merged_merge_bases = make_virtual_commit(opt->repo, tree,
"ancestor");
ancestor_name = "empty tree";
+ } else if (opt->ancestor && !opt->priv->call_depth) {
+ ancestor_name = opt->ancestor;
} else if (merge_bases) {
ancestor_name = "merged common ancestors";
} else {
merged_merge_bases),
&result_tree);
strbuf_release(&merge_base_abbrev);
+ opt->ancestor = NULL; /* avoid accidental re-use of opt->ancestor */
if (clean < 0) {
flush_output(opt);
return clean;
{
int clean;
- assert(opt->ancestor == NULL);
+ assert(opt->ancestor == NULL ||
+ !strcmp(opt->ancestor, "constructed merge base"));
if (merge_start(opt, repo_get_commit_tree(opt->repo, h1)))
return -1;
oid_to_hex(merge_bases[i]));
commit_list_insert(base, &ca);
}
+ if (num_merge_bases == 1)
+ opt->ancestor = "constructed merge base";
}
repo_hold_locked_index(opt->repo, &lock, LOCK_DIE_ON_ERROR);