Tests redirect to err file when grepping stderr
[stgit.git] / t / t4000-upgrade.sh
blob1dbb032badca8cf63be1ec245e23a1b46e923b4c
1 #!/bin/sh
3 # Copyright (c) 2007 Karl Hasselström
6 test_description='Make sure that we can use old StGit repositories'
8 . ./test-lib.sh
10 for ver in 1.1 1.0 0.19 0.12 0.8; do
12 tar zxf "$TEST_DIRECTORY"/t4000/$ver.tar.gz
13 cd $ver || exit 1
15 test_expect_success \
16 "v$ver: Check the list of applied and unapplied patches" '
17 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
18 [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
21 test_expect_success \
22 "v$ver: Make sure the .git/patches directory is no longer there" '
23 test_path_is_missing .git/patches
26 test_expect_success \
27 "v$ver: Make sure the 'description' is migrated to the config" '
28 [ "$(echo $(git config branch.master.description))" = "cool branch" ]
31 test_expect_success \
32 "v$ver: Make sure the base ref is no longer there" '
33 test_must_fail git show-ref --verify --quiet refs/bases/master
36 test_expect_success \
37 "v$ver: Make sure old format version config keys are gone" '
38 test_must_fail git config branch.master.stgit.stackformatversion &&
39 test_must_fail git config branch.master.stgitformatversion
42 test_expect_success \
43 "v$ver: Make sure patch refs are present" '
44 [ $(git show-ref | grep -c "refs\/patches\/master\/p0$") -eq 1 ] &&
45 [ $(git show-ref | grep -c "refs\/patches\/master\/p1$") -eq 1 ] &&
46 [ $(git show-ref | grep -c "refs\/patches\/master\/p2$") -eq 1 ] &&
47 [ $(git show-ref | grep -c "refs\/patches\/master\/p3$") -eq 1 ] &&
48 [ $(git show-ref | grep -c "refs\/patches\/master\/p4$") -eq 1 ]
51 test_expect_success \
52 "v$ver: Make sure patch log refs are gone" '
53 [ $(git show-ref | grep -c "refs\/patches\/master\/p0\.log") -eq 0 ] &&
54 [ $(git show-ref | grep -c "refs\/patches\/master\/p1\.log") -eq 0 ] &&
55 [ $(git show-ref | grep -c "refs\/patches\/master\/p2\.log") -eq 0 ] &&
56 [ $(git show-ref | grep -c "refs\/patches\/master\/p3\.log") -eq 0 ] &&
57 [ $(git show-ref | grep -c "refs\/patches\/master\/p4\.log") -eq 0 ]
60 test_expect_success \
61 "v$ver: Make sure basic push/pop work as expected" '
62 stg pop &&
63 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1" ] &&
64 [ "$(echo $(stg series --unapplied --noprefix))" = "p2 p3 p4" ] &&
65 stg push -a &&
66 [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4" ]
69 cd ..
70 done
72 test_done