File: t4100-publish.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 (129 lines) | stat: -rwxr-xr-x 2,895 bytes parent folder | download | duplicates (4)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/sh
#
# Copyright (c) 2009 Catalin Marinas
#

test_description='Exercise the publish command.

Create/modify patches on the stack and publish them to a separate branch.'

. ./test-lib.sh

test_same_tree () {
	stack_tree=$(git rev-parse master^{tree})
	public_tree=$(git rev-parse master.public^{tree})
	test "$stack_tree" = "$public_tree"
}

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

test_expect_success \
	'Create some patches' \
	'
	stg new p1 -m p1 &&
	echo foo1 > foo1.txt &&
	stg add foo1.txt &&
	stg refresh &&
	stg new p2 -m p2 &&
	echo foo2 > foo2.txt &&
	stg add foo2.txt &&
	stg refresh &&
	stg new p3 -m p3 &&
	echo foo3 > foo3.txt &&
	stg add foo3.txt &&
	stg refresh
	'

test_expect_success \
	'Publish the stack for the first time' \
	'
	stg publish &&
	test "$(stg id)" = "$(stg id master.public)"
	'

test_expect_success \
	'Modify a patch and publish the changes' \
	'
	stg pop &&
	echo foo2 >> foo2.txt &&
	stg refresh &&
	stg push &&
	old_public=$(stg id master.public) &&
	stg publish -m "p2 updated" &&
	test_same_tree &&
	new_public=$(stg id master.public) &&
	test $(git rev-list $old_public..$new_public | wc -l) -eq 1
	'

test_expect_success \
	'Create new patches and publish them' \
	'
	stg new p4 -m p4 &&
	echo foo4 > foo4.txt &&
	stg add foo4.txt &&
	stg refresh &&
	stg new p5 -m p5 &&
	echo foo5 > foo5.txt &&
	stg add foo5.txt &&
	stg refresh &&
	stg new empty -m empty &&
	old_public=$(stg id master.public) &&
	stg publish -m "Ignored message" &&
	test_same_tree &&
	new_public=$(stg id master.public) &&
	test $(git rev-list $old_public..$new_public | wc -l) -eq 2
	'

test_expect_success \
	'Rebase the current stack and publish a merge' \
	'
	stg pop -a &&
	echo foo0 > foo0.txt &&
	stg add foo0.txt &&
	git commit -m "foo0.txt added" &&
	stg push -a &&
	old_public=$(stg id master.public) &&
	stg publish -m "Merge with base" &&
	test_same_tree &&
	new_public=$(stg id master.public) &&
	test $(git rev-list $old_public..$new_public | wc -l) -eq 2 &&
	test "$(git merge-base master.public master)" = "$(stg id {base})"
	'

test_expect_success \
	'Re-publish without any changes' \
	'
	old_public=$(stg id master.public) &&
	stg publish -m "Ignored message" &&
	test_same_tree &&
	new_public=$(stg id master.public) &&
	test "$old_public" = "$new_public"
	'

test_expect_success \
	'Reorder patches and publish the changes' \
	'
	stg float p5 p4 p3 p2 p1 &&
	old_public=$(stg id master.public) &&
	stg publish -m "Ignored message" &&
	test_same_tree &&
	new_public=$(stg id master.public) &&
	test "$old_public" = "$new_public"
	'

test_expect_success \
	'Pop a patch and publish the changes' \
	'
	stg pop p3 &&
	old_public=$(stg id master.public) &&
	stg publish -m "p3 removed" &&
	test_same_tree &&
	new_public=$(stg id master.public) &&
	test $(git rev-list $old_public..$new_public | wc -l) -eq 1
	'

test_done