1#!/bin/sh
2#
3# Copyright (c) 2006 Eric Wong
4test_description='git-svn commit-diff'
5. ./lib-git-svn.sh
6
7if test -n "$GIT_SVN_NO_LIB" && test "$GIT_SVN_NO_LIB" -ne 0
8then
9 echo 'Skipping: commit-diff needs SVN libraries'
10 test_done
11 exit 0
12fi
13
14test_expect_success 'initialize repo' "
15 mkdir import &&
16 cd import &&
17 echo hello > readme &&
18 svn import -m 'initial' . $svnrepo &&
19 cd .. &&
20 echo hello > readme &&
21 git update-index --add readme &&
22 git commit -a -m 'initial' &&
23 echo world >> readme &&
24 git commit -a -m 'another'
25 "
26
27head=`git rev-parse --verify HEAD^0`
28prev=`git rev-parse --verify HEAD^1`
29
30# the internals of the commit-diff command are the same as the regular
31# commit, so only a basic test of functionality is needed since we've
32# already tested commit extensively elsewhere
33
34test_expect_success 'test the commit-diff command' "
35 test -n '$prev' && test -n '$head' &&
36 git-svn commit-diff '$prev' '$head' '$svnrepo' &&
37 svn co $svnrepo wc &&
38 cmp readme wc/readme
39 "
40
41test_done