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

[StGit PATCH] Test that we can add a new file to a non-topmost patch with refresh -p

From
Karl Hasselström <kha@treskal.com>
Date
Jul 18, 2008, 17:03 UTC
Message-ID
<20080718170225.10086.17504.stgit@yoghurt>
In-Reply-To
<20080718084127.GA7042@diana.vm.bytemark.co.uk>
We currently can't -- this is bug 12038, found by Jon Smirl. See
  https://gna.org/bugs/index.php?12038
Signed-off-by: Karl Hasselström <kha@treskal.com>
---

Here's a proper test that demonstrates the bug. It applies to the stable branch.

 t/t2701-refresh-p.sh |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
 create mode 100755 t/t2701-refresh-p.sh
diff --git a/t/t2701-refresh-p.sh b/t/t2701-refresh-p.sh
new file mode 100755
index 0000000..d42e90f
--- /dev/null
+++ b/t/t2701-refresh-p.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+test_description='Run "stg refresh -p"'
+
+. ./test-lib.sh
+
+# Ignore our own temp files.
+cat >> .git/info/exclude <<EOF
+expected*.txt
+files*.txt
+status*.txt
+EOF
+
+test_expect_success 'Initialize StGit stack' '
+    stg init &&
+    for i in 1 2; do
+        echo x > $i.txt &&
+        git add $i.txt &&
+        stg new p$i -m "Patch $i" &&
+        stg refresh
+    done
+'
+
+touch expected0.txt
+cat > expected1.txt <<EOF
+A 1.txt
+A new.txt
+EOF
+cat > expected2.txt <<EOF
+A 2.txt
+EOF
+test_expect_failure 'Add new file to non-top patch' '
+    stg status > status1.txt &&
+    diff -u expected0.txt status1.txt &&
+    echo y > new.txt &&
+    git add new.txt &&
+    stg refresh -p p1 &&
+    stg status > status2.txt &&
+    diff -u expected0.txt status2.txt &&
+    stg files p1 > files1.txt &&
+    diff -u expected1.txt files1.txt &&
+    stg files p2 > files2.txt &&
+    diff -u expected2.txt files2.txt
+'
+
+test_done
Previous: Karl HasselströmNext: Karl Hasselström
Message 3 of 9 in “stgit: bug with refresh and -p”
  1. Jon SmirlJul 18, 2008
  2. Karl HasselströmJul 18, 2008
  3. Test that we can add a new file to a non-topmost patch with refresh -pKarl Hasselström, Jul 18, 2008
  4. Karl HasselströmJul 18, 2008
  5. Jon SmirlJul 18, 2008
  6. Karl HasselströmJul 18, 2008
  7. Catalin MarinasJul 21, 2008
  8. Karl HasselströmJul 22, 2008
  9. Catalin MarinasJul 25, 2008

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.