if options.fold:
out.start('Folding commit %s' % commit_id)
- # try a direct git-apply first
+ # try a direct git apply first
if not git.apply_diff(bottom, top):
- git.merge(bottom, git.get_head(), top, recursive = True)
+ git.merge_recursive(bottom, git.get_head(), top)
out.done()
elif options.update:
'Port those patches to orig tree' '
(
cd foo &&
- GIT_DIR=../bar/.git git-format-patch --stdout \
- $(cd ../bar && stg id master:{base})..HEAD | git-am -3 -k
+ GIT_DIR=../bar/.git git format-patch --stdout \
- $(cd ../bar && stg id base@master)..HEAD | git am -3 -k
++ $(cd ../bar && stg id master:{base})..HEAD | git am -3 -k
)
'
test_expect_success \
'Port those patches to orig tree' \
'(cd foo &&
- GIT_DIR=../bar/.git git-format-patch --stdout \
+ GIT_DIR=../bar/.git git format-patch --stdout \
- $(cd ../bar && stg id base@master)..HEAD |
+ $(cd ../bar && stg id master:{base})..HEAD |
- git-am -3 -k
+ git am -3 -k
)
'
for i in 0 1 2 3 4; do
stg new p$i -m p$i;
done &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
- test_expect_success 'Pop two patches with git-reset' '
+ test_expect_success 'Pop two patches with git reset' '
git reset --hard HEAD~2 &&
- ! stg refresh &&
+ command_error stg refresh &&
stg repair &&
stg refresh &&
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p3 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
'
test_expect_success 'Create a new patch' '
stg new q0 -m q0 &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 q0" ] &&
- [ "$(echo $(stg unapplied))" = "p3 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 q0" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
'
- test_expect_success 'Go to an unapplied patch with with git-reset' '
+ test_expect_success 'Go to an unapplied patch with with git reset' '
git reset --hard $(stg id p3) &&
- ! stg refresh &&
+ command_error stg refresh &&
stg repair &&
stg refresh &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "q0 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "q0 p4" ]
'
- test_expect_success 'Go back to below the stack base with git-reset' '
+ test_expect_success 'Go back to below the stack base with git reset' '
git reset --hard foo-tag &&
stg repair &&
- [ "$(echo $(stg applied))" = "" ] &&
- [ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 q0 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p0 p1 p2 p3 q0 p4" ]
'
test_done
--- /dev/null
- test_expect_success 'git-rm a file' '
+#!/bin/sh
+
+test_description='"stg refresh" with removed files'
+
+. ./test-lib.sh
+
+# Ignore our own temp files.
+cat >> .git/info/exclude <<EOF
+expected*.txt
+files*.txt
+status*.txt
+EOF
+
+reset () {
+ stg pop -a > /dev/null
+ git reset --hard > /dev/null
+}
+
+test_expect_success 'Initialize StGit stack' '
+ stg init &&
+ echo x > x.txt &&
+ echo y > y.txt &&
+ git add x.txt y.txt &&
+ git commit -m "Add some files"
+'
+
+cat > expected0.txt <<EOF
+D y.txt
+EOF
+printf '' > expected1.txt
- test_expect_success 'git-rm a file together with other changes' '
++test_expect_success 'git rm a file' '
+ stg new -m p0 &&
+ git rm y.txt &&
+ stg status > status0.txt &&
+ test_cmp expected0.txt status0.txt &&
+ stg refresh &&
+ stg status > status1.txt &&
+ test_cmp expected1.txt status1.txt &&
+ stg files | sort > files.txt &&
+ test_cmp expected0.txt files.txt
+'
+
+reset
+
+cat > expected0.txt <<EOF
+D y.txt
+M x.txt
+EOF
+printf '' > expected1.txt
++test_expect_success 'git rm a file together with other changes' '
+ stg new -m p1 &&
+ echo x2 >> x.txt &&
+ git rm y.txt &&
+ stg status > status0.txt &&
+ test_cmp expected0.txt status0.txt &&
+ stg refresh &&
+ stg status > status1.txt &&
+ test_cmp expected1.txt status1.txt &&
+ stg files | sort > files.txt &&
+ test_cmp expected0.txt files.txt
+'
+
+reset
+
+cat > expected0.txt <<EOF
+D y.txt
+EOF
+printf '' > expected1.txt
+test_expect_success 'rm a file' '
+ stg new -m p2 &&
+ rm y.txt &&
+ stg status > status0.txt &&
+ test_cmp expected0.txt status0.txt &&
+ stg refresh &&
+ stg status > status1.txt &&
+ test_cmp expected1.txt status1.txt &&
+ stg files | sort > files.txt &&
+ test_cmp expected0.txt files.txt
+'
+
+reset
+
+cat > expected0.txt <<EOF
+D y.txt
+M x.txt
+EOF
+printf '' > expected1.txt
+test_expect_success 'rm a file together with other changes' '
+ stg new -m p3 &&
+ echo x2 >> x.txt &&
+ rm y.txt &&
+ stg status > status0.txt &&
+ test_cmp expected0.txt status0.txt &&
+ stg refresh &&
+ stg status > status1.txt &&
+ test_cmp expected1.txt status1.txt &&
+ stg files | sort > files.txt &&
+ test_cmp expected0.txt files.txt
+'
+
+test_done