chiark / gitweb /
git-debrebase: `prepush' is now a silent no-op if unstitched.
[dgit.git] / tests / tests / gdr-subcommands
index f6d817d88eb3a37b367c411a39ac709e1df113f0..e94f83e308765a878b45d444245377e8196830f0 100755 (executable)
@@ -2,8 +2,9 @@
 set -e
 . tests/lib
 
-t-dependencies git-buildpackage libfile-fnmatch-perl faketime
+t-dependencies GDR
 
+t-tstunt-parsechangelog
 t-setup-import gdr-convert-gbp
 
 cd $p
@@ -12,10 +13,16 @@ t-dgit setup-mergechangelogs
 
 mix-it () {
        t-git-next-date
+
        local m=$(git symbolic-ref HEAD)
        t-some-changes "subcommands $m 1"
-       t-dgit -wgf quilt-fixup
+
+       # we want patches mde by dgit, not gdr, for our test cases
+       t-dgit --git-debrebase=true -wgf quilt-fixup
+       t-git-next-date
+
        t-some-changes "subcommands $m 2"
+       t-git-next-date
 }
 
 git checkout -b stitched-laundered master
@@ -28,10 +35,12 @@ mix-it
 
 git checkout -b unstitched-laundered master
 mix-it
+git branch before-unstitch/unstitched-laundered
 t-git-debrebase
 t-gdr-good laundered
 
 git checkout -b unstitched-mixed master
+git branch before-unstitch/unstitched-mixed
 t-git-debrebase
 mix-it
 
@@ -58,19 +67,40 @@ subcmd () {
                before=before-$work
                git branch $before
 
+               local xopts=''
+
+               case "$checkletters" in
+               XX*)
+                       fail "$checkletters" # for debugging
+                       ;;
+               esac
+
+               case "$checkletters" in
+               X*)
+                       t-expect-fail E:'snags: [0-9]* blockers' \
+                       t-git-debrebase $xopts $subcmd
+                       xopts+=' --force'
+                       next_checkletter
+                       ;;
+               esac
+
                case "$checkletters" in
                N*)
                        t-expect-fail E:. \
-                       t-git-debrebase $subcmd
-                       t-git-debrebase --noop-ok $subcmd
+                       t-git-debrebase $xopts $subcmd
+                       xopts+=' --noop-ok'
+                       next_checkletter
                        ;;
+               esac
+
+               case "$checkletters" in
                [EF]:*)
                        t-expect-fail "$checkletters" \
-                       t-git-debrebase $subcmd
+                       t-git-debrebase $xopts $subcmd
                        continue
                        ;;
                *)
-                       t-git-debrebase $subcmd
+                       t-git-debrebase $xopts $subcmd
                        ;;
                esac
 
@@ -130,7 +160,7 @@ make_check () {
                git reset --hard HEAD^1
                ;;
        P*)
-               t-dgit -wgf --quilt=check quilt-fixup
+               t-dgit -wgf --quilt=nofix quilt-fixup
                git diff HEAD~ debian/patches | egrep .
                git diff --quiet HEAD~ -- ':.' ':!debian/patches'
                git reset --hard HEAD~
@@ -145,10 +175,20 @@ make_check () {
        f*)
                t-has-ancestor HEAD refs/heads/$before
                ;;
+       Z*)
+               t-refs-same-start
+               t-refs-same refs/heads/$work
+               t-refs-same refs/heads/before-unstitch/$startbranch
+               t-ref-head
+               ;;
+       *)
+               fail "$1"
+               ;;
        esac
 }
 
 Ec="F:No ongoing git-debrebase session"
+Ep="F:Patch export produced patch amendments"
 
 # input state:
 #  stitched?           st'd    st'd    unst'd  unst'd
@@ -160,16 +200,19 @@ Ec="F:No ongoing git-debrebase session"
 #
 subcmd ''              Ult     Ull     Vlt     Vl
 subcmd stitch          Ns      Nu      Sltf    Stf
-#subcmd        pre-push        Ns      Nu      Sltf    Stf
+subcmd prepush         ns      nu      Sltf    Stf
 subcmd quick           ns      Sl      Sltf    Sl
 subcmd conclude        "$Ec"   "$Ec"   Sltf    Sl
-#subcmd        make-patches    sPft    sPft    uPft    uPft
-#subcmd        dgit-upload-hook Psft   Psft    SPft    SPft
+subcmd scrap           Ns      Ns      Z       Z
+subcmd make-patches    sPft    "$Ep"   uPft    "$Ep"
 #
 # result codes, each one is a check:
 #   E:$pat     } this is an error (must come first)
 #   F:$pat     } arg is passed to expect-fail
 #
+#   X          should fail due to snags, but succeed when forced
+#   XX         crash out of script for manual debugging
+#
 #   N          this is a noop, error unless --noop-ok
 #   n          this is a silent noop
 # both of these imply tf; but, specify also one of   u s
@@ -180,6 +223,7 @@ subcmd      conclude        "$Ec"   "$Ec"   Sltf    Sl
 #   V          ffq-prev remains unchanged; implies also u
 #   s          result is stitched, debrebase-last exists and is unchanged
 #   S          result is stitch just made, remaining letters apply to result~
+#   Z          result is rewind to before changes made
 #
 #   P          result is add-patches, remaining letters apply to result~
 #