File: t2100-pull-policy-fetch.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 (58 lines) | stat: -rwxr-xr-x 1,551 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
#
# Copyright (c) 2007 Yann Dirson
#

test_description='Excercise pull-policy "fetch-rebase".'

. ./test-lib.sh

# don't need this repo, but better not drop it, see t1100
#rm -rf .git

# Need a repo to clone
test_create_repo upstream

test_expect_success \
    'Setup upstream repo, clone it, and add patches to the clone' \
    '
    (cd upstream && stg init) &&
    stg clone upstream clone &&
    (cd clone &&
     git config branch.master.stgit.pull-policy fetch-rebase &&
     git config --list &&
     stg new c1 -m c1 &&
     echo a > file && stg add file && stg refresh
    )
    '

test_expect_success \
    'Add non-rewinding commit upstream and pull it from clone' \
    '
    (cd upstream && stg new u1 -m u1 &&
     echo a > file2 && stg add file2 && stg refresh) &&
    (cd clone && stg pull) &&
    test -e clone/file2
    '

# note: with pre-1.5 Git the clone is not automatically recorded
# as rewinding, and thus heads/origin is not moved, but the stack
# is still correctly rebased
test_expect_success \
    'Rewind/rewrite upstream commit and pull it from clone' \
    '
    (cd upstream && echo b >> file2 && stg refresh) &&
    (cd clone && stg pull) &&
    test `wc -l <clone/file2` = 2
    '

# this one ensures the guard against commits does not unduly trigger
test_expect_success \
    'Rewind/rewrite upstream commit and fetch it from clone before pulling' \
    '
    (cd upstream && echo c >> file2 && stg refresh) &&
    (cd clone && git fetch && stg pull) &&
    test `wc -l <clone/file2` = 3
    '

test_done