t / t5815-submodule-protos.shon commit cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch (f8adbec)
   1#!/bin/sh
   2
   3test_description='test protocol whitelisting with submodules'
   4. ./test-lib.sh
   5. "$TEST_DIRECTORY"/lib-proto-disable.sh
   6
   7setup_ext_wrapper
   8setup_ssh_wrapper
   9
  10test_expect_success 'setup repository with submodules' '
  11        mkdir remote &&
  12        git init remote/repo.git &&
  13        (cd remote/repo.git && test_commit one) &&
  14        # submodule-add should probably trust what we feed it on the cmdline,
  15        # but its implementation is overly conservative.
  16        GIT_ALLOW_PROTOCOL=ssh git submodule add remote:repo.git ssh-module &&
  17        GIT_ALLOW_PROTOCOL=ext git submodule add "ext::fake-remote %S repo.git" ext-module &&
  18        git commit -m "add submodules"
  19'
  20
  21test_expect_success 'clone with recurse-submodules fails' '
  22        test_must_fail git clone --recurse-submodules . dst
  23'
  24
  25test_expect_success 'setup individual updates' '
  26        rm -rf dst &&
  27        git clone . dst &&
  28        git -C dst submodule init
  29'
  30
  31test_expect_success 'update of ssh allowed' '
  32        git -C dst submodule update ssh-module
  33'
  34
  35test_expect_success 'update of ext not allowed' '
  36        test_must_fail git -C dst submodule update ext-module
  37'
  38
  39test_expect_success 'user can override whitelist' '
  40        GIT_ALLOW_PROTOCOL=ext git -C dst submodule update ext-module
  41'
  42
  43test_done