Exercise "stg pull" on patches just appending lines.
authorYann Dirson <ydirson@altern.org>
Sun, 16 Apr 2006 10:52:44 +0000 (12:52 +0200)
committerCatalin Marinas <catalin.marinas@gmail.com>
Tue, 2 May 2006 20:36:54 +0000 (21:36 +0100)
It indeed reveals a problem in "push": appended lines are appended
again, as the already-applied patch is not detected.

Signed-off-by: Yann Dirson <ydirson@altern.org>
t/t1201-pull-trailing.sh [new file with mode: 0755]

diff --git a/t/t1201-pull-trailing.sh b/t/t1201-pull-trailing.sh
new file mode 100755 (executable)
index 0000000..142f894
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Yann Dirson
+#
+
+test_description='test
+
+'
+
+. ./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 foo
+
+test_expect_success \
+    'Setup and clone tree, and setup changes' \
+    "(cd foo &&
+      printf 'a\nb\n' > file && git add file && git commit -m .
+     ) &&
+     stg clone foo bar &&
+     (cd bar && stg new p1 -m p1
+      printf 'c\n' >> file && stg refresh
+     )
+"
+
+test_expect_success \
+    'Port those patches to orig tree' \
+    "(cd foo &&
+      GIT_DIR=../bar/.git git-format-patch --stdout bases/master..HEAD |
+      git-am -3 -k
+     )
+"
+
+test_expect_success \
+    'Pull those patches applied upstream' \
+    "(cd bar && stg pull
+     )
+"
+
+test_expect_success \
+    'Check that all went well' \
+    "diff -u foo/file bar/file
+"
+
+test_done