git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGit PATCH 2/5] New test: Try "stg push" in a subdirectory

From
Karl Hasselström <kha@treskal.com>
Date
Oct 7, 2007, 23:24 UTC
Message-ID
<20071007232447.13070.53630.stgit@yoghurt>
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
Previous: Karl HasselströmNext: Karl Hasselström
Message 3 of 6 in “Make push and refresh subdirectory safe”
  1. 0/5 Make push and refresh subdirectory safeKarl Hasselström, Oct 7, 2007
  2. 1/5 Infrastructure for current directory handlingKarl Hasselström, Oct 7, 2007
  3. 2/5 New test: Try "stg push" in a subdirectoryKarl Hasselström, Oct 7, 2007
  4. 3/5 Make "stg push" subdirectory safeKarl Hasselström, Oct 7, 2007
  5. 4/5 New test: try "stg refresh" in a subdirectoryKarl Hasselström, Oct 7, 2007
  6. 5/5 Make "stg refresh" subdirectory safeKarl Hasselström, Oct 7, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.