From: Junio C Hamano Date: Tue, 11 Sep 2012 18:35:26 +0000 (-0700) Subject: Merge branch 'jc/merge-bases' X-Git-Tag: v1.8.0-rc0~78 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=34f5130af84f7a37fba327d5a5be4f4427dc6886;p=git.git Merge branch 'jc/merge-bases' Optimise the "merge-base" computation a bit, and also update its users that do not need the full merge-base information to call a cheaper subset. * jc/merge-bases: reduce_heads(): reimplement on top of remove_redundant() merge-base: "--is-ancestor A B" get_merge_bases_many(): walk from many tips in parallel in_merge_bases(): use paint_down_to_common() merge_bases_many(): split out the logic to paint history in_merge_bases(): omit unnecessary redundant common ancestor reduction http-push: use in_merge_bases() for fast-forward check receive-pack: use in_merge_bases() for fast-forward check in_merge_bases(): support only one "other" commit --- 34f5130af84f7a37fba327d5a5be4f4427dc6886 diff --cc builtin/merge-base.c index 2f223a664,0568b07e1..1bc799104 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@@ -23,9 -23,10 +23,10 @@@ static int show_merge_base(struct commi } static const char * const merge_base_usage[] = { - "git merge-base [-a|--all] ...", - "git merge-base [-a|--all] --octopus ...", - "git merge-base --independent ...", - "git merge-base --is-ancestor ", + N_("git merge-base [-a|--all] ..."), + N_("git merge-base [-a|--all] --octopus ..."), + N_("git merge-base --independent ..."), ++ N_("git merge-base --is-ancestor "), NULL }; @@@ -77,11 -92,14 +92,14 @@@ int cmd_merge_base(int argc, const cha int show_all = 0; int octopus = 0; int reduce = 0; + int is_ancestor = 0; struct option options[] = { - OPT_BOOLEAN('a', "all", &show_all, "output all common ancestors"), - OPT_BOOLEAN(0, "octopus", &octopus, "find ancestors for a single n-way merge"), - OPT_BOOLEAN(0, "independent", &reduce, "list revs not reachable from others"), + OPT_BOOLEAN('a', "all", &show_all, N_("output all common ancestors")), + OPT_BOOLEAN(0, "octopus", &octopus, N_("find ancestors for a single n-way merge")), + OPT_BOOLEAN(0, "independent", &reduce, N_("list revs not reachable from others")), + OPT_BOOLEAN(0, "is-ancestor", &is_ancestor, - "is the first one ancestor of the other?"), ++ N_("is the first one ancestor of the other?")), OPT_END() }; diff --cc submodule.c index 19dc6a6c0,8fc974d1c..d133796c9 --- a/submodule.c +++ b/submodule.c @@@ -788,10 -738,9 +788,10 @@@ static int find_first_merges(struct obj die("revision walk setup failed"); while ((commit = get_revision(&revs)) != NULL) { struct object *o = &(commit->object); - if (in_merge_bases(b, &commit, 1)) + if (in_merge_bases(b, commit)) add_object_array(o, NULL, &merges); } + reset_revision_walk(); /* Now we've got all merges that contain a and b. Prune all * merges that contain another found merge and save them in