Git fork
at reftables-rust 91 lines 2.1 kB view raw
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 13GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 14export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 15 16. ./test-lib.sh 17 18test_expect_success 'setup' ' 19 git config --global protocol.file.allow always 20' 21 22test_expect_success 'submodule on detached working tree' ' 23 git init --bare remote && 24 test_create_repo bundle1 && 25 ( 26 cd bundle1 && 27 test_commit "shoot" && 28 git rev-parse --verify HEAD >../expect 29 ) && 30 mkdir home && 31 ( 32 cd home && 33 GIT_WORK_TREE="$(pwd)" && 34 GIT_DIR="$(pwd)/.dotfiles" && 35 export GIT_WORK_TREE GIT_DIR && 36 git clone --bare ../remote .dotfiles && 37 git submodule add ../bundle1 .vim/bundle/sogood && 38 test_commit "sogood" && 39 ( 40 unset GIT_WORK_TREE GIT_DIR && 41 cd .vim/bundle/sogood && 42 git rev-parse --verify HEAD >actual && 43 test_cmp ../../../../expect actual 44 ) && 45 git push origin main 46 ) && 47 mkdir home2 && 48 ( 49 cd home2 && 50 git clone --bare ../remote .dotfiles && 51 GIT_WORK_TREE="$(pwd)" && 52 GIT_DIR="$(pwd)/.dotfiles" && 53 export GIT_WORK_TREE GIT_DIR && 54 git checkout main && 55 git submodule update --init && 56 ( 57 unset GIT_WORK_TREE GIT_DIR && 58 cd .vim/bundle/sogood && 59 git rev-parse --verify HEAD >actual && 60 test_cmp ../../../../expect actual 61 ) 62 ) 63' 64 65test_expect_success 'submodule on detached working pointed by core.worktree' ' 66 mkdir home3 && 67 ( 68 cd home3 && 69 GIT_DIR="$(pwd)/.dotfiles" && 70 export GIT_DIR && 71 git clone --bare ../remote "$GIT_DIR" && 72 git config core.bare false && 73 git config core.worktree .. && 74 git checkout main && 75 git submodule add ../bundle1 .vim/bundle/dupe && 76 test_commit "dupe" && 77 git push origin main 78 ) && 79 ( 80 cd home && 81 GIT_DIR="$(pwd)/.dotfiles" && 82 export GIT_DIR && 83 git config core.bare false && 84 git config core.worktree .. && 85 git pull && 86 git submodule update --init && 87 test -f .vim/bundle/dupe/shoot.t 88 ) 89' 90 91test_done