]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/receive-deny-current-branch-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 21 Nov 2018 13:57:51 +0000 (22:57 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Nov 2018 13:57:51 +0000 (22:57 +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

index c17ce94e12ee34c5b822b0e09fcd6d7264e759ad,d28a35c9920b84a3c527f333fd5aa3998f1a3630..1e9d0dfb6d857db81b6c7bde55f2be45a594cb91
@@@ -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