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