chiark / gitweb /
test suite: checkout: Check we end up on the right branch each time
[dgit.git] / tests / tests / checkout
1 #!/bin/bash
2 set -e
3 . tests/lib
4 t-tstunt-parsechangelog
5
6 t-setup-import examplegit
7
8 now-on () {
9         local branch=$(git symbolic-ref HEAD)
10         test "$branch" = "refs/heads/$1"
11 }
12
13 p=example
14
15 mkdir $p.2
16 cd $p.2
17
18 git init
19 t-dgit setup-new-tree
20 t-dgit checkout -p $p unstable
21
22 now-on dgit/sid
23 t-refs-same-start
24 t-ref-head
25 t-ref-same refs/tags/test-dummy/$v
26
27 t-dgit checkout -p $p stable
28 now-on dgit/stable
29
30 t-dgit checkout -d no-such-distro sid
31 t-ref-head
32 now-on dgit/sid
33
34 t-dgit checkout stable
35 now-on dgit/stable
36
37 git branch -D dgit/sid
38 t-dgit checkout -d no-such-distro sid
39 t-ref-head
40 now-on dgit/sid
41
42 git reflog --pretty=tformat:%gs >../reflog.got
43 cat >../reflog.expect <<END
44 dgit checkout sid
45 dgit checkout stable
46 dgit checkout sid
47 dgit checkout stable
48 dgit checkout unstable
49 END
50 diff -u ../reflog.{expect,got}
51
52 git for-each-ref --format='%(refname)' refs/heads | t-sort >../refs.got
53 cat >../refs.expect <<END
54 refs/heads/dgit/sid
55 refs/heads/dgit/stable
56 END
57 diff -u ../refs.{expect,got}
58
59 t-ok