Skip to content

Commit

Permalink
http-push: use in_merge_bases() for fast-forward check
Browse files Browse the repository at this point in the history
The original computed merge-base between HEAD and the remote ref and
checked if the remote ref is a merge base between them, in order to
make sure that we are fast-forwarding.

Instead, call in_merge_bases(remote, HEAD) which does the same.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Aug 28, 2012
1 parent 5d55915 commit 6571225
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions http-push.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,9 +1610,8 @@ static int verify_merge_base(unsigned char *head_sha1, struct ref *remote)
{
struct commit *head = lookup_commit_or_die(head_sha1, "HEAD");
struct commit *branch = lookup_commit_or_die(remote->old_sha1, remote->name);
struct commit_list *merge_bases = get_merge_bases(head, branch, 1);

return (merge_bases && !merge_bases->next && merge_bases->item == branch);
return in_merge_bases(branch, head);
}

static int delete_remote_branch(const char *pattern, int force)
Expand Down

0 comments on commit 6571225

Please sign in to comment.