From: Junio C Hamano Date: Wed, 21 Nov 2018 13:57:51 +0000 (+0900) Subject: Merge branch 'jc/receive-deny-current-branch-fix' into maint X-Git-Tag: v2.19.2~43 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7d483e9c00516413a9c2dafc24a6ecb40975b02b Merge branch 'jc/receive-deny-current-branch-fix' into maint 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 --- 7d483e9c00516413a9c2dafc24a6ecb40975b02b diff --cc builtin/receive-pack.c index c17ce94e12,d28a35c992..1e9d0dfb6d --- 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.");