git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH 2/5] New test: Try "stg push" in a subdirectory
Date: Mon, 08 Oct 2007 01:24:48 +0200	[thread overview]
Message-ID: <20071007232447.13070.53630.stgit@yoghurt> (raw)
In-Reply-To: <20071007231949.13070.49517.stgit@yoghurt>

This currently fails for the non-fast-forward cases.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 t/t1205-push-subdir.sh |   55 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100755 t/t1205-push-subdir.sh


diff --git a/t/t1205-push-subdir.sh b/t/t1205-push-subdir.sh
new file mode 100755
index 0000000..6502c20
--- /dev/null
+++ b/t/t1205-push-subdir.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+test_description='Test the push command from a subdirectory'
+. ./test-lib.sh
+stg init
+
+test_expect_success 'Create some patches' '
+    mkdir foo
+    for i in 0 1 2; do
+        stg new p$i -m p$i &&
+        echo x$i >> x.txt &&
+        echo y$i >> foo/y.txt &&
+        stg add x.txt foo/y.txt &&
+        stg refresh
+    done &&
+    [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
+    [ "$(echo $(stg unapplied))" = "" ]
+'
+
+test_expect_success 'Fast-forward push from a subdir' '
+    stg pop &&
+    [ "$(echo $(cat x.txt))" = "x0 x1" ] &&
+    [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
+    cd foo &&
+    stg push &&
+    cd .. &&
+    [ "$(echo $(cat x.txt))" = "x0 x1 x2" ] &&
+    [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
+'
+
+test_expect_failure 'Modifying push from a subdir' '
+    stg pop &&
+    [ "$(echo $(cat x.txt))" = "x0 x1" ] &&
+    [ "$(echo $(cat foo/y.txt))" = "y0 y1" ] &&
+    stg new extra -m extra &&
+    echo extra >> extra.txt &&
+    stg add extra.txt &&
+    stg refresh &&
+    cd foo &&
+    stg push &&
+    cd .. &&
+    [ "$(echo $(cat x.txt))" = "x0 x1 x2" ] &&
+    [ "$(echo $(cat foo/y.txt))" = "y0 y1 y2" ]
+'
+
+test_expect_failure 'Conflicting push from subdir' '
+    stg pop p1 p2 &&
+    [ "$(echo $(cat x.txt))" = "x0" ] &&
+    [ "$(echo $(cat foo/y.txt))" = "y0" ] &&
+    cd foo &&
+    ! stg push p2 &&
+    cd .. &&
+    [ "$(echo $(stg status --conflict))" = "foo/y.txt x.txt" ]
+'
+
+test_done

  parent reply	other threads:[~2007-10-07 23:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-07 23:24 [StGit PATCH 0/5] Make push and refresh subdirectory safe Karl Hasselström
2007-10-07 23:24 ` [StGit PATCH 1/5] Infrastructure for current directory handling Karl Hasselström
2007-10-07 23:24 ` Karl Hasselström [this message]
2007-10-07 23:24 ` [StGit PATCH 3/5] Make "stg push" subdirectory safe Karl Hasselström
2007-10-07 23:25 ` [StGit PATCH 4/5] New test: try "stg refresh" in a subdirectory Karl Hasselström
2007-10-07 23:25 ` [StGit PATCH 5/5] Make "stg refresh" subdirectory safe Karl Hasselström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071007232447.13070.53630.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).