interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t9106-git-svn-commit-diff-clobber.sh

107 lines · 2699 bytes Raw Blame History
1#!/bin/sh
2#
3# Copyright (c) 2006 Eric Wong
4test_description='git svn commit-diff clobber'
5
6. ./lib-git-svn.sh
7
8test_expect_success 'initialize repo' '
9 mkdir import &&
10 (
11 cd import &&
12 echo initial >file &&
13 svn_cmd import -m "initial" . "$svnrepo"
14 ) &&
15 echo initial > file &&
16 git update-index --add file &&
17 git commit -a -m "initial"
18 '
19test_expect_success 'commit change from svn side' '
20 svn_cmd co "$svnrepo" t.svn &&
21 (
22 cd t.svn &&
23 echo second line from svn >>file &&
24 poke file &&
25 svn_cmd commit -m "second line from svn"
26 ) &&
27 rm -rf t.svn
28 '
29
30test_expect_success 'commit conflicting change from git' '
31 echo second line from git >> file &&
32 git commit -a -m "second line from git" &&
33 test_must_fail git svn commit-diff -r1 HEAD~1 HEAD "$svnrepo"
34'
35
36test_expect_success 'commit complementing change from git' '
37 git reset --hard HEAD~1 &&
38 echo second line from svn >> file &&
39 git commit -a -m "second line from svn" &&
40 echo third line from git >> file &&
41 git commit -a -m "third line from git" &&
42 git svn commit-diff -r2 HEAD~1 HEAD "$svnrepo"
43 '
44
45test_expect_success 'dcommit fails to commit because of conflict' '
46 git svn init "$svnrepo" &&
47 git svn fetch &&
48 git reset --hard refs/remotes/git-svn &&
49 svn_cmd co "$svnrepo" t.svn &&
50 (
51 cd t.svn &&
52 echo fourth line from svn >>file &&
53 poke file &&
54 svn_cmd commit -m "fourth line from svn"
55 ) &&
56 rm -rf t.svn &&
57 echo "fourth line from git" >> file &&
58 git commit -a -m "fourth line from git" &&
59 test_must_fail git svn dcommit
60 '
61
62test_expect_success 'dcommit does the svn equivalent of an index merge' "
63 git reset --hard refs/remotes/git-svn &&
64 echo 'index merge' > file2 &&
65 git update-index --add file2 &&
66 git commit -a -m 'index merge' &&
67 echo 'more changes' >> file2 &&
68 git update-index file2 &&
69 git commit -a -m 'more changes' &&
70 git svn dcommit
71 "
72
73test_expect_success 'commit another change from svn side' '
74 svn_cmd co "$svnrepo" t.svn &&
75 (
76 cd t.svn &&
77 echo third line from svn >>file &&
78 poke file &&
79 svn_cmd commit -m "third line from svn"
80 ) &&
81 rm -rf t.svn
82 '
83
84test_expect_success 'multiple dcommit from git svn will not clobber svn' "
85 git reset --hard refs/remotes/git-svn &&
86 echo new file >> new-file &&
87 git update-index --add new-file &&
88 git commit -a -m 'new file' &&
89 echo clobber > file &&
90 git commit -a -m 'clobber' &&
91 test_must_fail git svn dcommit
92 "
93
94
95test_expect_success 'check that rebase really failed' '
96 git status >output &&
97 test_grep currently.rebasing output
98'
99
100test_expect_success 'resolve, continue the rebase and dcommit' "
101 echo clobber and I really mean it > file &&
102 git update-index file &&
103 git rebase --continue &&
104 git svn dcommit
105 "
106
107test_done