summaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-11 11:35:26 -0700
committerJunio C Hamano <gitster@pobox.com>2012-09-11 11:36:05 -0700
commit34f5130af84f7a37fba327d5a5be4f4427dc6886 (patch)
tree1f8836fe7fb70566e31b3f4f5d1475fabd95981b /submodule.c
parent0083f1d43a7280aefa23656eaac7266139484b24 (diff)
parentf37d3c755209234acfc2ca280027ebdab8e9ea8a (diff)
downloadgit-34f5130af84f7a37fba327d5a5be4f4427dc6886.tar.gz
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
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/submodule.c b/submodule.c
index 19dc6a6c0d..d133796c9c 100644
--- a/submodule.c
+++ b/submodule.c
@@ -788,7 +788,7 @@ static int find_first_merges(struct object_array *result, const char *path,
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();
@@ -803,7 +803,7 @@ static int find_first_merges(struct object_array *result, const char *path,
contains_another = 0;
for (j = 0; j < merges.nr; j++) {
struct commit *m2 = (struct commit *) merges.objects[j].item;
- if (i != j && in_merge_bases(m2, &m1, 1)) {
+ if (i != j && in_merge_bases(m2, m1)) {
contains_another = 1;
break;
}
@@ -865,18 +865,18 @@ int merge_submodule(unsigned char result[20], const char *path,
}
/* check whether both changes are forward */
- if (!in_merge_bases(commit_base, &commit_a, 1) ||
- !in_merge_bases(commit_base, &commit_b, 1)) {
+ if (!in_merge_bases(commit_base, commit_a) ||
+ !in_merge_bases(commit_base, commit_b)) {
MERGE_WARNING(path, "commits don't follow merge-base");
return 0;
}
/* Case #1: a is contained in b or vice versa */
- if (in_merge_bases(commit_a, &commit_b, 1)) {
+ if (in_merge_bases(commit_a, commit_b)) {
hashcpy(result, b);
return 1;
}
- if (in_merge_bases(commit_b, &commit_a, 1)) {
+ if (in_merge_bases(commit_b, commit_a)) {
hashcpy(result, a);
return 1;
}