summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d92a3fd)
Signed-off-by: Yann Dirson <ydirson@altern.org>
# Copyright (c) 2007 Yann Dirson
#
# Copyright (c) 2007 Yann Dirson
#
-test_description='Excercise pull-policy "fetch-rebase".'
+test_description='Excercise pull-policy "rebase".'
-# 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 repo-config branch.master.stgit.pull-policy fetch-rebase &&
- git repo-config --list &&
- stg new c1 -m c1 &&
- echo a > file && stg add file && stg refresh
- )
- '
-
- 'Add non-rewinding commit upstream and pull it from clone' \
+ 'Fork stack off parent branch, and add patches to the stack' \
- (cd upstream && stg new u1 -m u1 &&
- echo a > file2 && stg add file2 && stg refresh) &&
- (cd clone && stg pull) &&
- test -e clone/file2
+ stg init &
+ git branch -m master parent &&
+ stg branch --create stack &&
+ git repo-config branch.stack.stgit.pull-policy rebase &&
+ git repo-config --list &&
+ stg new c1 -m c1 &&
+ echo a > file && stg add file && stg refresh
-# 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
- 'Rewind/rewrite upstream commit and pull it from clone' \
+ 'Add non-rewinding commit in parent and pull the stack' \
- (cd upstream && echo b >> file2 && stg refresh) &&
- (cd clone && stg pull) &&
- test `wc -l <clone/file2` = 2
+ stg branch parent && stg new u1 -m u1 &&
+ echo b > file2 && stg add file2 && stg refresh &&
+ stg branch stack && stg pull &&
+ test -e file2
-# this one ensures the guard against commits does not unduly trigger
- 'Rewind/rewrite upstream commit and fetch it from clone before pulling' \
+ 'Rewind/rewrite commit in parent and pull the stack' \
- (cd upstream && echo c >> file2 && stg refresh) &&
- (cd clone && git fetch && stg pull) &&
- test `wc -l <clone/file2` = 3
+ stg branch parent && echo b >> file2 && stg refresh &&
+ stg branch stack && stg pull &&
+ test `wc -l <file2` = 2
'
# this one exercises the guard against commits
# (use a new file to avoid mistaking a conflict for a success)
test_expect_success \
'
# this one exercises the guard against commits
# (use a new file to avoid mistaking a conflict for a success)
test_expect_success \
- 'New upstream commit and commit a patch in clone' \
+ 'New commit in parent and commit a patch in stack' \
- (cd upstream && stg new u2 -m u2 &&
- echo a > file3 && stg add file3 && stg refresh) &&
- (cd clone && stg commit && stg new c2 -m c2 &&
- echo a >> file && stg refresh)
+ stg branch parent && stg new u2 -m u2 &&
+ echo c > file3 && stg add file3 && stg refresh &&
+ stg branch stack && stg commit && stg new c2 -m c2 &&
+ echo a >> file && stg refresh
- 'Try to and commit a patch in clone' \
- '(cd clone && stg pull)'
+ 'Try to pull/rebase now that stack base has moved' \
+ 'stg pull'
+
+test_expect_success \
+ 'Force the pull/rebase, but do not push yet' \
+ 'stg pull --force --nopush'
+test_expect_failure \
+ '...check we lost the committed patch' \
+ 'test -e file'
+test_expect_failure \
+ '...and check we get a conflict while pushing' \
+ 'stg push'