t / t5617-clone-submodules-remote.shon commit rebase: fast-forward --fork-point in more cases (4effc5b)
   1#!/bin/sh
   2
   3test_description='Test cloning repos with submodules using remote-tracking branches'
   4
   5. ./test-lib.sh
   6
   7pwd=$(pwd)
   8
   9test_expect_success 'setup' '
  10        git checkout -b master &&
  11        test_commit commit1 &&
  12        mkdir sub &&
  13        (
  14                cd sub &&
  15                git init &&
  16                test_commit subcommit1 &&
  17                git tag sub_when_added_to_super
  18        ) &&
  19        git submodule add "file://$pwd/sub" sub &&
  20        git commit -m "add submodule" &&
  21        (
  22                cd sub &&
  23                test_commit subcommit2
  24        )
  25'
  26
  27test_expect_success 'clone with --no-remote-submodules' '
  28        test_when_finished "rm -rf super_clone" &&
  29        git clone --recurse-submodules --no-remote-submodules "file://$pwd/." super_clone &&
  30        (
  31                cd super_clone/sub &&
  32                git diff --exit-code sub_when_added_to_super
  33        )
  34'
  35
  36test_expect_success 'clone with --remote-submodules' '
  37        test_when_finished "rm -rf super_clone" &&
  38        git clone --recurse-submodules --remote-submodules "file://$pwd/." super_clone &&
  39        (
  40                cd super_clone/sub &&
  41                git diff --exit-code remotes/origin/master
  42        )
  43'
  44
  45test_expect_success 'check the default is --no-remote-submodules' '
  46        test_when_finished "rm -rf super_clone" &&
  47        git clone --recurse-submodules "file://$pwd/." super_clone &&
  48        (
  49                cd super_clone/sub &&
  50                git diff --exit-code sub_when_added_to_super
  51        )
  52'
  53
  54test_done