Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2006 Eric Wong |
| 4 | test_description='git-svn commit-diff' |
| 5 | . ./lib-git-svn.sh |
| 6 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 7 | test_expect_success 'initialize repo' ' |
Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 8 | mkdir import && |
| 9 | cd import && |
| 10 | echo hello > readme && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 11 | svn import -m "initial" . "$svnrepo" && |
Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 12 | cd .. && |
| 13 | echo hello > readme && |
| 14 | git update-index --add readme && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 15 | git commit -a -m "initial" && |
Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 16 | echo world >> readme && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 17 | git commit -a -m "another" |
| 18 | ' |
Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 19 | |
| 20 | head=`git rev-parse --verify HEAD^0` |
| 21 | prev=`git rev-parse --verify HEAD^1` |
| 22 | |
| 23 | # the internals of the commit-diff command are the same as the regular |
| 24 | # commit, so only a basic test of functionality is needed since we've |
| 25 | # already tested commit extensively elsewhere |
| 26 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 27 | test_expect_success 'test the commit-diff command' ' |
| 28 | test -n "$prev" && test -n "$head" && |
| 29 | git-svn commit-diff -r1 "$prev" "$head" "$svnrepo" && |
| 30 | svn co "$svnrepo" wc && |
Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 31 | cmp readme wc/readme |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 32 | ' |
Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 33 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 34 | test_expect_success 'commit-diff to a sub-directory (with git-svn config)' ' |
| 35 | svn import -m "sub-directory" import "$svnrepo"/subdir && |
| 36 | git-svn init --minimize-url "$svnrepo"/subdir && |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 37 | git-svn fetch && |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 38 | git-svn commit-diff -r3 "$prev" "$head" && |
| 39 | svn cat "$svnrepo"/subdir/readme > readme.2 && |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 40 | cmp readme readme.2 |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 41 | ' |
Eric Wong | d3a840d | 2007-01-26 01:32:45 -0800 | [diff] [blame] | 42 | |
Eric Wong | 27e9fb8 | 2006-06-27 19:39:12 -0700 | [diff] [blame] | 43 | test_done |