t / t7409-submodule-detached-work-tree.shon commit merge: refuse --commit with --squash (1d14d0c)
   1#!/bin/sh
   2#
   3# Copyright (c) 2012 Daniel GraƱa
   4#
   5
   6test_description='Test submodules on detached working tree
   7
   8This test verifies that "git submodule" initialization, update and addition works
   9on detached working trees
  10'
  11
  12TEST_NO_CREATE_REPO=1
  13. ./test-lib.sh
  14
  15test_expect_success 'submodule on detached working tree' '
  16        git init --bare remote &&
  17        test_create_repo bundle1 &&
  18        (
  19                cd bundle1 &&
  20                test_commit "shoot" &&
  21                git rev-parse --verify HEAD >../expect
  22        ) &&
  23        mkdir home &&
  24        (
  25                cd home &&
  26                GIT_WORK_TREE="$(pwd)" &&
  27                GIT_DIR="$(pwd)/.dotfiles" &&
  28                export GIT_WORK_TREE GIT_DIR &&
  29                git clone --bare ../remote .dotfiles &&
  30                git submodule add ../bundle1 .vim/bundle/sogood &&
  31                test_commit "sogood" &&
  32                (
  33                        unset GIT_WORK_TREE GIT_DIR &&
  34                        cd .vim/bundle/sogood &&
  35                        git rev-parse --verify HEAD >actual &&
  36                        test_cmp ../../../../expect actual
  37                ) &&
  38                git push origin master
  39        ) &&
  40        mkdir home2 &&
  41        (
  42                cd home2 &&
  43                git clone --bare ../remote .dotfiles &&
  44                GIT_WORK_TREE="$(pwd)" &&
  45                GIT_DIR="$(pwd)/.dotfiles" &&
  46                export GIT_WORK_TREE GIT_DIR &&
  47                git checkout master &&
  48                git submodule update --init &&
  49                (
  50                        unset GIT_WORK_TREE GIT_DIR &&
  51                        cd .vim/bundle/sogood &&
  52                        git rev-parse --verify HEAD >actual &&
  53                        test_cmp ../../../../expect actual
  54                )
  55        )
  56'
  57
  58test_expect_success 'submodule on detached working pointed by core.worktree' '
  59        mkdir home3 &&
  60        (
  61                cd home3 &&
  62                GIT_DIR="$(pwd)/.dotfiles" &&
  63                export GIT_DIR &&
  64                git clone --bare ../remote "$GIT_DIR" &&
  65                git config core.bare false &&
  66                git config core.worktree .. &&
  67                git checkout master &&
  68                git submodule add ../bundle1 .vim/bundle/dupe &&
  69                test_commit "dupe" &&
  70                git push origin master
  71        ) &&
  72        (
  73                cd home &&
  74                GIT_DIR="$(pwd)/.dotfiles" &&
  75                export GIT_DIR &&
  76                git config core.bare false &&
  77                git config core.worktree .. &&
  78                git pull &&
  79                git submodule update --init &&
  80                test -f .vim/bundle/dupe/shoot.t
  81        )
  82'
  83
  84test_done