@matheusbsbs / matheus-bagliano / commits / 23822a355d
Fork 0

read-tree: --trivial

This adds an option --trivial to restrict 3-way 'read-tree -m -u' to happen only if there is no file-level merging required. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Sep 29, 2005 at 08:16 UTC 23822a355de674f1d1321ad7e112f0fe40124aca
1 file changed +12
read-tree.c
+12
@@ -13,6 +13,8 @@
13 static int merge = 0;
14 static int update = 0;
15 static int index_only = 0;
16 +static int nontrivial_merge = 0;
17 +static int trivial_merges_only = 0;
18
19 static int head_idx = -1;
20 static int merge_size = 0;
@@ -275,6 +277,9 @@ static int unpack_trees(merge_fn_t fn)
277 if (unpack_trees_rec(posns, len, "", fn, &indpos))
278 return -1;
279
280 + if (trivial_merges_only && nontrivial_merge)
281 + die("Merge requires file-level merging");
282 +
283 check_updates(active_cache, active_nr);
284 return 0;
285 }
@@ -460,6 +465,8 @@ static int threeway_merge(struct cache_entry **stages)
465 verify_uptodate(index);
466 }
467
468 + nontrivial_merge = 1;
469 +
470 /* #2, #3, #4, #6, #7, #9, #11. */
471 count = 0;
472 if (!head_match || !remote_match) {
@@ -629,6 +636,11 @@ int main(int argc, char **argv)
636 continue;
637 }
638
639 + if (!strcmp(arg, "--trivial")) {
640 + trivial_merges_only = 1;
641 + continue;
642 + }
643 +
644 /* "-m" stands for "merge", meaning we start in stage 1 */
645 if (!strcmp(arg, "-m")) {
646 if (stage || merge)