Git fork
1#!/bin/sh
2#
3# Copyright (c) 2007 Eric Wong
4test_description='git svn dcommit clobber series'
5. ./lib-git-svn.sh
6
7test_expect_success 'initialize repo' '
8 mkdir import &&
9 (cd import &&
10 awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file &&
11 svn_cmd import -m "initial" . "$svnrepo"
12 ) &&
13 git svn init "$svnrepo" &&
14 git svn fetch &&
15 test -e file
16 '
17
18test_expect_success '(supposedly) non-conflicting change from SVN' '
19 test x"$(sed -n -e 58p < file)" = x58 &&
20 test x"$(sed -n -e 61p < file)" = x61 &&
21 svn_cmd co "$svnrepo" tmp &&
22 (cd tmp &&
23 sed -e "s/^58$/5588/" -e "s/^61$/6611/" file >file.munged &&
24 mv file.munged file &&
25 poke file &&
26 test x"$(sed -n -e 58p < file)" = x5588 &&
27 test x"$(sed -n -e 61p < file)" = x6611 &&
28 svn_cmd commit -m "58 => 5588, 61 => 6611"
29 )
30 '
31
32test_expect_success 'some unrelated changes to git' "
33 echo hi > life &&
34 git update-index --add life &&
35 git commit -m hi-life &&
36 echo bye >> life &&
37 git commit -m bye-life life
38 "
39
40test_expect_success 'change file but in unrelated area' "
41 test x\"\$(sed -n -e 4p < file)\" = x4 &&
42 test x\"\$(sed -n -e 7p < file)\" = x7 &&
43 sed -e 's/^4\$/4444/' \
44 -e 's/^7\$/7777/' \
45 file >file.munged &&
46 mv file.munged file &&
47 test x\"\$(sed -n -e 4p < file)\" = x4444 &&
48 test x\"\$(sed -n -e 7p < file)\" = x7777 &&
49 git commit -m '4 => 4444, 7 => 7777' file &&
50 git svn dcommit &&
51 svn_cmd up tmp &&
52 cd tmp &&
53 test x\"\$(sed -n -e 4p < file)\" = x4444 &&
54 test x\"\$(sed -n -e 7p < file)\" = x7777 &&
55 test x\"\$(sed -n -e 58p < file)\" = x5588 &&
56 test x\"\$(sed -n -e 61p < file)\" = x6611
57 "
58
59test_expect_success 'attempt to dcommit with a dirty index' '
60 echo foo >>file &&
61 git add file &&
62 test_must_fail git svn dcommit
63'
64
65test_done