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
This commit is contained in:
@ -480,7 +480,6 @@ static const char *update(struct command *cmd)
|
||||
!prefixcmp(name, "refs/heads/")) {
|
||||
struct object *old_object, *new_object;
|
||||
struct commit *old_commit, *new_commit;
|
||||
struct commit_list *bases, *ent;
|
||||
|
||||
old_object = parse_object(old_sha1);
|
||||
new_object = parse_object(new_sha1);
|
||||
@ -493,12 +492,7 @@ static const char *update(struct command *cmd)
|
||||
}
|
||||
old_commit = (struct commit *)old_object;
|
||||
new_commit = (struct commit *)new_object;
|
||||
bases = get_merge_bases(old_commit, new_commit, 1);
|
||||
for (ent = bases; ent; ent = ent->next)
|
||||
if (!hashcmp(old_sha1, ent->item->object.sha1))
|
||||
break;
|
||||
free_commit_list(bases);
|
||||
if (!ent) {
|
||||
if (!in_merge_bases(old_commit, new_commit)) {
|
||||
rp_error("denying non-fast-forward %s"
|
||||
" (you should pull first)", name);
|
||||
return "non-fast-forward";
|
||||
|
Reference in New Issue
Block a user