Merge branch 'jc/receive-deny-current-branch-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 30 Oct 2018 06:43:46 +0000 (15:43 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Oct 2018 06:43:46 +0000 (15:43 +0900)
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

1  2 
builtin/receive-pack.c
t/t5516-fetch-push.sh

@@@ -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.");
Simple merge