summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2ab706a)
raw | patch | inline | side by side (parent: 2ab706a)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 6 Sep 2005 19:53:56 +0000 (12:53 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 11 Sep 2005 01:27:42 +0000 (18:27 -0700) |
This will help us detect if real-world example merges have multiple
merge-base candidates and one of them matches one head while another
matches the other head.
Signed-off-by: Junio C Hamano <junkio@cox.net>
merge-base candidates and one of them matches one head while another
matches the other head.
Signed-off-by: Junio C Hamano <junkio@cox.net>
read-tree.c | patch | blob | history | |
t/t1000-read-tree-m-3way.sh | patch | blob | history |
diff --git a/read-tree.c b/read-tree.c
index fed2a3c544c0090d04175042fe5999d9c86bc1a9..3808d2398db1222f5f5e5da0610d8efaae676784 100644 (file)
--- a/read-tree.c
+++ b/read-tree.c
*
* Copyright (C) Linus Torvalds, 2005
*/
+#define DBRT_DEBUG 1
+
#include "cache.h"
#include "object.h"
return ret;
}
-#define DBRT_DEBUG 0
-
static int unpack_trees_rec(struct tree_entry_list **posns, int len,
const char *base, merge_fn_t fn, int *indpos)
{
}
}
-#if DBRT_DEBUG
+#if DBRT_DEBUG > 1
if (first)
printf("index %s\n", first);
#endif
for (i = 0; i < len; i++) {
if (!posns[i] || posns[i] == &df_conflict_list)
continue;
-#if DBRT_DEBUG
+#if DBRT_DEBUG > 1
printf("%d %s\n", i + 1, posns[i]->name);
#endif
if (!first || entcmp(first, firstdir,
if (merge) {
int ret;
-#if DBRT_DEBUG
+#if DBRT_DEBUG > 1
printf("%s:\n", first);
for (i = 0; i < src_size; i++) {
printf(" %d ", i);
#endif
ret = fn(src);
-#if DBRT_DEBUG
+#if DBRT_DEBUG > 1
printf("Added %d entries\n", ret);
#endif
*indpos += ret;
return 1;
}
+#if DBRT_DEBUG
+static void show_stage_entry(FILE *o,
+ const char *label, const struct cache_entry *ce)
+{
+ fprintf(stderr, "%s%06o %s %d\t%s\n",
+ label,
+ ntohl(ce->ce_mode),
+ sha1_to_hex(ce->sha1),
+ ce_stage(ce),
+ ce->name);
+}
+#endif
+
static int threeway_merge(struct cache_entry **stages)
{
struct cache_entry *index;
if (!same(remote, head)) {
for (i = 1; i < head_idx; i++) {
if (same(stages[i], head)) {
- head_match = 1;
+ head_match = i;
}
if (same(stages[i], remote)) {
- remote_match = 1;
+ remote_match = i;
}
}
}
}
}
}
+#if DBRT_DEBUG
+ else {
+ fprintf(stderr, "read-tree: warning #16 detected\n");
+ show_stage_entry(stderr, "head ", stages[head_match]);
+ show_stage_entry(stderr, "remote ", stages[remote_match]);
+ }
+#endif
if (head) { count += keep_entry(head); }
if (remote) { count += keep_entry(remote); }
return count;
index f1cd50cee9a43fffb173db8190698a25637fd2a5..c387e9ea08483ef9cc9fb3a61790eaa544c4973b 100755 (executable)
or (2) match B.
------------------------------------------------------------------
15 exists O==A O==B take B must match A if exists.
+ ------------------------------------------------------------------
+ 16 exists O==A O==B barf must match A if exists.
+ *multi* in one in another
-------------------------------------------------------------------
Note: if we want to implement 2ALT and 3ALT we need to be careful.
git-update-index --add NN &&
git-read-tree -m $tree_O $tree_A $tree_B"
+# #16
+test_expect_success \
+ '16 - A matches in one and B matches in another.' \
+ 'rm -f .git/index F16 &&
+ echo F16 >F16 &&
+ git-update-index --add F16 &&
+ tree0=`git-write-tree` &&
+ echo E16 >F16 &&
+ git-update-index F16 &&
+ tree1=`git-write-tree` &&
+ git-read-tree -m $tree0 $tree1 $tree1 $tree0 &&
+ git-ls-files --stage'
+
test_done