Linus Torvalds | 1211be6 | 2007-08-17 09:56:54 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='fetching and pushing project with subproject' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success setup ' |
| 8 | test_tick && |
| 9 | mkdir -p sub && ( |
| 10 | cd sub && |
| 11 | git init && |
| 12 | >subfile && |
Jonathan Nieder | a48fcd8 | 2010-10-30 20:46:54 -0500 | [diff] [blame] | 13 | git add subfile && |
Linus Torvalds | 1211be6 | 2007-08-17 09:56:54 -0700 | [diff] [blame] | 14 | git commit -m "subproject commit #1" |
| 15 | ) && |
Jonathan Nieder | a48fcd8 | 2010-10-30 20:46:54 -0500 | [diff] [blame] | 16 | >mainfile && |
Linus Torvalds | 1211be6 | 2007-08-17 09:56:54 -0700 | [diff] [blame] | 17 | git add sub mainfile && |
| 18 | test_tick && |
| 19 | git commit -m "superproject commit #1" |
| 20 | ' |
| 21 | |
| 22 | test_expect_success clone ' |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 23 | git clone "file://$(pwd)/.git" cloned && |
Linus Torvalds | 1211be6 | 2007-08-17 09:56:54 -0700 | [diff] [blame] | 24 | (git rev-parse HEAD; git ls-files -s) >expected && |
| 25 | ( |
| 26 | cd cloned && |
| 27 | (git rev-parse HEAD; git ls-files -s) >../actual |
| 28 | ) && |
Jeff King | 82ebb0b | 2008-03-12 17:36:36 -0400 | [diff] [blame] | 29 | test_cmp expected actual |
Linus Torvalds | 1211be6 | 2007-08-17 09:56:54 -0700 | [diff] [blame] | 30 | ' |
| 31 | |
| 32 | test_expect_success advance ' |
| 33 | echo more >mainfile && |
| 34 | git update-index --force-remove sub && |
| 35 | mv sub/.git sub/.git-disabled && |
| 36 | git add sub/subfile mainfile && |
| 37 | mv sub/.git-disabled sub/.git && |
| 38 | test_tick && |
| 39 | git commit -m "superproject commit #2" |
| 40 | ' |
| 41 | |
| 42 | test_expect_success fetch ' |
| 43 | (git rev-parse HEAD; git ls-files -s) >expected && |
| 44 | ( |
| 45 | cd cloned && |
| 46 | git pull && |
| 47 | (git rev-parse HEAD; git ls-files -s) >../actual |
| 48 | ) && |
Jeff King | 82ebb0b | 2008-03-12 17:36:36 -0400 | [diff] [blame] | 49 | test_cmp expected actual |
Linus Torvalds | 1211be6 | 2007-08-17 09:56:54 -0700 | [diff] [blame] | 50 | ' |
| 51 | |
| 52 | test_done |