Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2009 Eric Wong |
| 4 | # |
| 5 | |
| 6 | test_description='git svn property tests' |
| 7 | . ./lib-git-svn.sh |
| 8 | |
| 9 | test_expect_success 'setup repo with a git repo inside it' ' |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 10 | svn_cmd co "$svnrepo" s && |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 11 | ( |
| 12 | cd s && |
| 13 | git init && |
| 14 | test -f .git/HEAD && |
| 15 | > .git/a && |
| 16 | echo a > a && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 17 | svn_cmd add .git a && |
| 18 | svn_cmd commit -m "create a nested git repo" && |
| 19 | svn_cmd up && |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 20 | echo hi >> .git/a && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 21 | svn_cmd commit -m "modify .git/a" && |
| 22 | svn_cmd up |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 23 | ) |
| 24 | ' |
| 25 | |
| 26 | test_expect_success 'clone an SVN repo containing a git repo' ' |
| 27 | git svn clone "$svnrepo" g && |
| 28 | echo a > expect && |
| 29 | test_cmp expect g/a |
| 30 | ' |
| 31 | |
| 32 | test_expect_success 'SVN-side change outside of .git' ' |
| 33 | ( |
| 34 | cd s && |
| 35 | echo b >> a && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 36 | svn_cmd commit -m "SVN-side change outside of .git" && |
| 37 | svn_cmd up && |
| 38 | svn_cmd log -v | fgrep "SVN-side change outside of .git" |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 39 | ) |
| 40 | ' |
| 41 | |
| 42 | test_expect_success 'update git svn-cloned repo' ' |
| 43 | ( |
| 44 | cd g && |
| 45 | git svn rebase && |
| 46 | echo a > expect && |
| 47 | echo b >> expect && |
Matthew DeVore | dcbaa0b | 2018-10-05 14:54:04 -0700 | [diff] [blame] | 48 | test_cmp expect a && |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 49 | rm expect |
| 50 | ) |
| 51 | ' |
| 52 | |
| 53 | test_expect_success 'SVN-side change inside of .git' ' |
| 54 | ( |
| 55 | cd s && |
| 56 | git add a && |
| 57 | git commit -m "add a inside an SVN repo" && |
| 58 | git log && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 59 | svn_cmd add --force .git && |
| 60 | svn_cmd commit -m "SVN-side change inside of .git" && |
| 61 | svn_cmd up && |
| 62 | svn_cmd log -v | fgrep "SVN-side change inside of .git" |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 63 | ) |
| 64 | ' |
| 65 | |
| 66 | test_expect_success 'update git svn-cloned repo' ' |
| 67 | ( |
| 68 | cd g && |
| 69 | git svn rebase && |
| 70 | echo a > expect && |
| 71 | echo b >> expect && |
Matthew DeVore | dcbaa0b | 2018-10-05 14:54:04 -0700 | [diff] [blame] | 72 | test_cmp expect a && |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 73 | rm expect |
| 74 | ) |
| 75 | ' |
| 76 | |
| 77 | test_expect_success 'SVN-side change in and out of .git' ' |
| 78 | ( |
| 79 | cd s && |
| 80 | echo c >> a && |
| 81 | git add a && |
| 82 | git commit -m "add a inside an SVN repo" && |
Eygene Ryabinkin | da083d6 | 2009-05-08 12:06:16 +0400 | [diff] [blame] | 83 | svn_cmd commit -m "SVN-side change in and out of .git" && |
| 84 | svn_cmd up && |
| 85 | svn_cmd log -v | fgrep "SVN-side change in and out of .git" |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 86 | ) |
| 87 | ' |
| 88 | |
| 89 | test_expect_success 'update git svn-cloned repo again' ' |
| 90 | ( |
| 91 | cd g && |
| 92 | git svn rebase && |
| 93 | echo a > expect && |
| 94 | echo b >> expect && |
| 95 | echo c >> expect && |
Matthew DeVore | dcbaa0b | 2018-10-05 14:54:04 -0700 | [diff] [blame] | 96 | test_cmp expect a && |
Eric Wong | b03a71a | 2009-01-11 18:23:38 -0800 | [diff] [blame] | 97 | rm expect |
| 98 | ) |
| 99 | ' |
| 100 | |
| 101 | test_done |