summaryrefslogtreecommitdiff
path: root/merge-tree.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-03-05 19:44:06 -0800
committerJunio C Hamano <gitster@pobox.com>2008-03-09 00:43:47 -0800
commit5803c6f8a2faf8cfbbd046d9ebd682b82bb2b086 (patch)
tree4f586a9a7d7735115167257b023ac9e7fc01869d /merge-tree.c
parent40d934df72eaf244c826d5c26da0896ce7185cb6 (diff)
downloadgit-5803c6f8a2faf8cfbbd046d9ebd682b82bb2b086.tar.gz
Add return value to 'traverse_tree()' callback
This allows the callback to return an error value, but it can also specify which of the tree entries that it actually used up by returning a positive mask value. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-tree.c')
-rw-r--r--merge-tree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/merge-tree.c b/merge-tree.c
index a3511b76ca..8be0b9f910 100644
--- a/merge-tree.c
+++ b/merge-tree.c
@@ -287,31 +287,32 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])
* The successful merge rules are the same as for the three-way merge
* in git-read-tree.
*/
-static void threeway_callback(int n, unsigned long mask, struct name_entry *entry, struct traverse_info *info)
+static int threeway_callback(int n, unsigned long mask, struct name_entry *entry, struct traverse_info *info)
{
/* Same in both? */
if (same_entry(entry+1, entry+2)) {
if (entry[0].sha1) {
resolve(info, NULL, entry+1);
- return;
+ return mask;
}
}
if (same_entry(entry+0, entry+1)) {
if (entry[2].sha1 && !S_ISDIR(entry[2].mode)) {
resolve(info, entry+1, entry+2);
- return;
+ return mask;
}
}
if (same_entry(entry+0, entry+2)) {
if (entry[1].sha1 && !S_ISDIR(entry[1].mode)) {
resolve(info, NULL, entry+1);
- return;
+ return mask;
}
}
unresolved(info, entry);
+ return mask;
}
static void merge_trees(struct tree_desc t[3], const char *base)