File: t1301-repair.sh

package info (click to toggle)
stgit 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,748 kB
  • sloc: python: 10,558; sh: 5,739; lisp: 2,678; makefile: 142; perl: 42
file content (80 lines) | stat: -rwxr-xr-x 1,766 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
# Copyright (c) 2006 Karl Hasselström
test_description='Test the repair command.'
. ./test-lib.sh

test_expect_success \
    'Repair in a non-initialized repository' \
    'command_error stg repair'

test_expect_success \
    'Initialize the StGIT repository' \
    'stg init'

test_expect_success \
    'Repair in a repository without patches' \
    'stg repair'

test_expect_success \
    'Create a patch' \
    '
    stg new foo -m foo &&
    echo foo > foo.txt &&
    stg add foo.txt &&
    stg refresh
    '

test_expect_success \
    'Repair when there is nothing to do' \
    'stg repair'

test_expect_success \
    'Create a GIT commit' \
    '
    echo bar > bar.txt &&
    stg add bar.txt &&
    git commit -a -m bar
    '

test_expect_success 'Turn one GIT commit into a patch' '
    [ $(stg series --applied -c) -eq 1 ] &&
    stg repair &&
    [ $(stg series --applied -c) -eq 2 ]
    '

test_expect_success \
    'Create three more GIT commits' \
    '
    echo one > numbers.txt &&
    stg add numbers.txt &&
    git commit -a -m one &&
    echo two >> numbers.txt &&
    git commit -a -m two &&
    echo three >> numbers.txt &&
    git commit -a -m three
    '

test_expect_success 'Turn three GIT commits into patches' '
    [ $(stg series --applied -c) -eq 2 ] &&
    stg repair &&
    [ $(stg series --applied -c) -eq 5 ]
    '

test_expect_success \
    'Create a merge commit' \
    '
    git checkout -b br master^^ &&
    echo woof > woof.txt &&
    stg add woof.txt &&
    git commit -a -m woof &&
    git checkout master &&
    git pull . br
    '

test_expect_success 'Repair in the presence of a merge commit' '
    [ $(stg series --applied -c) -eq 5 ] &&
    stg repair &&
    [ $(stg series --applied -c) -eq 0 ]
'

test_done