]> git.neil.brown.name Git - git.git/commitdiff
Merge branch 'jk/quarantine-received-objects'
authorJunio C Hamano <gitster@pobox.com>
Mon, 24 Apr 2017 05:07:51 +0000 (22:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Apr 2017 05:07:52 +0000 (22:07 -0700)
Add finishing touches to a recent topic.

* jk/quarantine-received-objects:
  refs: reject ref updates while GIT_QUARANTINE_PATH is set
  receive-pack: document user-visible quarantine effects
  receive-pack: drop tmp_objdir_env from run_update_hook

1  2 
builtin/receive-pack.c
refs.c
t/t5547-push-quarantine.sh

Simple merge
diff --cc refs.c
index d1e1b4399b36746dedaabb38de2332481267ea48,916b0d5fa53fda935d1ef220c1652fb07212f4f6..a3d5f42e37345096628ab83fee629f22df1bb7b5
--- 1/refs.c
--- 2/refs.c
+++ b/refs.c
@@@ -1641,8 -1463,14 +1641,14 @@@ int create_symref(const char *ref_targe
  int ref_transaction_commit(struct ref_transaction *transaction,
                           struct strbuf *err)
  {
 -      struct ref_store *refs = get_ref_store(NULL);
 +      struct ref_store *refs = transaction->ref_store;
  
+       if (getenv(GIT_QUARANTINE_ENVIRONMENT)) {
+               strbuf_addstr(err,
+                             _("ref updates forbidden inside quarantine environment"));
+               return -1;
+       }
        return refs->be->transaction_commit(refs, transaction, err);
  }
  
index af9fcd833a5e9e4997dd5cb917ac13f4b07f10ab,462bfc9cba81e0db9a8a97b94d32dcb96de6eec7..113c87007f31abced0d93b3702f0b54f50ff4679
@@@ -33,29 -33,15 +33,40 @@@ test_expect_success 'rejected objects a
        test_cmp expect actual
  '
  
 +test_expect_success 'push to repo path with path separator (colon)' '
 +      # The interesting failure case here is when the
 +      # receiving end cannot access its original object directory,
 +      # so make it likely for us to generate a delta by having
 +      # a non-trivial file with multiple versions.
 +
 +      test-genrandom foo 4096 >file.bin &&
 +      git add file.bin &&
 +      git commit -m bin &&
 +
 +      if test_have_prereq MINGW
 +      then
 +              pathsep=";"
 +      else
 +              pathsep=":"
 +      fi &&
 +      git clone --bare . "xxx${pathsep}yyy.git" &&
 +
 +      echo change >>file.bin &&
 +      git commit -am change &&
 +      # Note that we have to use the full path here, or it gets confused
 +      # with the ssh host:path syntax.
 +      git push "$(pwd)/xxx${pathsep}yyy.git" HEAD
 +'
 +
+ test_expect_success 'updating a ref from quarantine is forbidden' '
+       git init --bare update.git &&
+       write_script update.git/hooks/pre-receive <<-\EOF &&
+       read old new refname
+       git update-ref refs/heads/unrelated $new
+       exit 1
+       EOF
+       test_must_fail git push update.git HEAD &&
+       git -C update.git fsck
+ '
  test_done