From: Junio C Hamano Date: Tue, 30 Oct 2018 06:43:46 +0000 (+0900) Subject: Merge branch 'jc/receive-deny-current-branch-fix' X-Git-Tag: v2.20.0-rc0~108 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fgit.git;a=commitdiff_plain;h=4c7f5440225aba8f0c7253575e5ffa933a267de7 Merge branch 'jc/receive-deny-current-branch-fix' The receive.denyCurrentBranch=updateInstead codepath kicked in even when the push should have been rejected due to other reasons, such as it does not fast-forward or the update-hook rejects it, which has been corrected. * jc/receive-deny-current-branch-fix: receive: denyCurrentBranch=updateinstead should not blindly update --- 4c7f5440225aba8f0c7253575e5ffa933a267de7 diff --cc builtin/receive-pack.c index 7f089be11e,d28a35c992..33187bd8e9 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@@ -1117,9 -1129,15 +1117,15 @@@ static const char *update(struct comman return "hook declined"; } + if (do_update_worktree) { + ret = update_worktree(new_oid->hash); + if (ret) + return ret; + } + if (is_null_oid(new_oid)) { struct strbuf err = STRBUF_INIT; - if (!parse_object(old_oid)) { + if (!parse_object(the_repository, old_oid)) { old_oid = NULL; if (ref_exists(name)) { rp_warning("Allowing deletion of corrupt ref.");