]> git.ipfire.org Git - thirdparty/git.git/commitdiff
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

index 7f089be11e2b33d222af7d217f7d228ee482ec5a,d28a35c9920b84a3c527f333fd5aa3998f1a3630..33187bd8e90252c283b7154bc7026e01d4e754ef
@@@ -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