summaryrefslogtreecommitdiff
path: root/tests/tests/drs-push-masterupdate
blob: 8457b59db43207d1eb08162f1d4b23e7cc89657b (plain)
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
#!/bin/bash
set -e
. tests/lib

t-drs
t-tstunt-parsechangelog

t-prep-newpackage example 1.0

cd $p

git tag common-ancestor

revision=1
t-dgit build
t-dgit push --new

push_and_check () {
	git push $dgitrepo $1

	oldmaster=`cd $dgitrepo && t-git-get-ref refs/heads/master`

	t-refs-same-start
	git checkout master
	t-commit 'Empty update'
	t-dgit build
	t-dgit push --new

	t-pushed-good master
}

t-check-master-undisturbed () {
	local master; master=`t-git-get-ref refs/heads/master`
	if [ x$master != x$oldmaster ]; then fail "bad update to master"; fi
}

t_check_pushed_master=t-check-master-undisturbed

git checkout -b divergent common-ancestor
git commit --allow-empty -m 'Has common ancestor'
git push $dgitrepo HEAD:master

push_and_check HEAD:master

git checkout --orphan newroot
git commit --allow-empty -m 'Has no common ancestor'

push_and_check +HEAD:master

t-ok