t / t5504-fetch-receive-strict.shon commit Merge branch 'jc/maint-pack-object-cycle' into maint (2e8722f)
   1#!/bin/sh
   2
   3test_description='fetch/receive strict mode'
   4. ./test-lib.sh
   5
   6test_expect_success setup '
   7        echo hello >greetings &&
   8        git add greetings &&
   9        git commit -m greetings &&
  10
  11        S=$(git rev-parse :greetings | sed -e "s|^..|&/|") &&
  12        X=$(echo bye | git hash-object -w --stdin | sed -e "s|^..|&/|") &&
  13        mv -f .git/objects/$X .git/objects/$S &&
  14
  15        test_must_fail git fsck
  16'
  17
  18test_expect_success 'fetch without strict' '
  19        rm -rf dst &&
  20        git init dst &&
  21        (
  22                cd dst &&
  23                git config fetch.fsckobjects false &&
  24                git config transfer.fsckobjects false &&
  25                test_must_fail git fetch ../.git master
  26        )
  27'
  28
  29test_expect_success 'fetch with !fetch.fsckobjects' '
  30        rm -rf dst &&
  31        git init dst &&
  32        (
  33                cd dst &&
  34                git config fetch.fsckobjects false &&
  35                git config transfer.fsckobjects true &&
  36                test_must_fail git fetch ../.git master
  37        )
  38'
  39
  40test_expect_success 'fetch with fetch.fsckobjects' '
  41        rm -rf dst &&
  42        git init dst &&
  43        (
  44                cd dst &&
  45                git config fetch.fsckobjects true &&
  46                git config transfer.fsckobjects false &&
  47                test_must_fail git fetch ../.git master
  48        )
  49'
  50
  51test_expect_success 'fetch with transfer.fsckobjects' '
  52        rm -rf dst &&
  53        git init dst &&
  54        (
  55                cd dst &&
  56                git config transfer.fsckobjects true &&
  57                test_must_fail git fetch ../.git master
  58        )
  59'
  60
  61test_expect_success 'push without strict' '
  62        rm -rf dst &&
  63        git init dst &&
  64        (
  65                cd dst &&
  66                git config fetch.fsckobjects false &&
  67                git config transfer.fsckobjects false
  68        ) &&
  69        git push dst master:refs/heads/test
  70'
  71
  72test_expect_success 'push with !receive.fsckobjects' '
  73        rm -rf dst &&
  74        git init dst &&
  75        (
  76                cd dst &&
  77                git config receive.fsckobjects false &&
  78                git config transfer.fsckobjects true
  79        ) &&
  80        git push dst master:refs/heads/test
  81'
  82
  83test_expect_success 'push with receive.fsckobjects' '
  84        rm -rf dst &&
  85        git init dst &&
  86        (
  87                cd dst &&
  88                git config receive.fsckobjects true &&
  89                git config transfer.fsckobjects false
  90        ) &&
  91        test_must_fail git push dst master:refs/heads/test
  92'
  93
  94test_expect_success 'push with transfer.fsckobjects' '
  95        rm -rf dst &&
  96        git init dst &&
  97        (
  98                cd dst &&
  99                git config transfer.fsckobjects true
 100        ) &&
 101        test_must_fail git push dst master:refs/heads/test
 102'
 103
 104test_done