t / t7409-submodule-detached-worktree.shon commit git-submodule: work with GIT_DIR/GIT_WORK_TREE (be8779f)
   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 detahced 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        (cd bundle1 && test_commit "shoot") &&
  19        mkdir home &&
  20        (
  21                cd home &&
  22                export GIT_WORK_TREE="$(pwd)" GIT_DIR="$(pwd)/.dotfiles" &&
  23                git clone --bare ../remote .dotfiles &&
  24                git submodule add ../bundle1 .vim/bundle/sogood &&
  25                test_commit "sogood" &&
  26                git push origin master
  27        ) &&
  28        mkdir home2 &&
  29        (
  30                cd home2 &&
  31                export GIT_WORK_TREE="$(pwd)" GIT_DIR="$(pwd)/.dotfiles" &&
  32                git clone --bare ../remote .dotfiles &&
  33                git submodule update --init
  34        )
  35'
  36
  37test_expect_success 'submodule on detached working pointed by core.worktree' '
  38        mkdir home3 &&
  39        (
  40                cd home3 &&
  41                export GIT_DIR="$(pwd)/.dotfiles" &&
  42                git clone --bare ../remote "$GIT_DIR" &&
  43                git config core.bare false &&
  44                git config core.worktree .. &&
  45                git submodule add ../bundle1 .vim/bundle/dupe &&
  46                test_commit "dupe" &&
  47                git push origin master
  48        ) &&
  49        (
  50                cd home &&
  51                export GIT_DIR="$(pwd)/.dotfiles" &&
  52                git config core.bare false &&
  53                git config core.worktree .. &&
  54                git pull &&
  55                git submodule update &&
  56                git submodule status &&
  57                test -d .vim/bundle/dupe
  58        )
  59'
  60
  61test_done