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

[PATCH] Test that pulls a patch creating a file that got modified afterwards

From
Yann Dirson <ydirson@altern.org>
Date
Apr 16, 2006, 20:40 UTC
Message-ID
<20060416204029.10137.80865.stgit@gandelf.nowhere.earth>
In-Reply-To
<20060416203448.10137.69093.stgit@gandelf.nowhere.earth>
From: Yann Dirson <ydirson@altern.org>

This demonstrates an issue wite has bitten me more than once: the stg branch adds a file in one patch, and modifies it in a later patch; then all patches get integrated in upstream tree, and at "stg pull" time, stgit believes there is a conflict, even when the patches are exactly the same.

This is normal as it requires the --merged flag on push or pull. So we rollback with "push --undo" and "push --merge" to finish. ---

 t/t1200-push-modified.sh |   64 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
new file mode 100755
index 0000000..7847a38
--- /dev/null
+++ b/t/t1200-push-modified.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Yann Dirson
+#
+
+test_description='Exercise pushing patches applied upstream.
+
+Especially, consider the case of a patch that adds a file, while a
+subsequent one modifies it, so we have to use --merged for push to
+detect the merge.  Reproduce the common workflow where one does not
+specify --merged, then rollback and retry with the correct flag.'
+
+. ./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 \
+    'Clone tree and setup changes' \
+    "stg clone foo bar &&
+     (cd bar && stg new p1 -m p1
+      printf 'a\nc\n' > file && stg add file && stg refresh &&
+      stg new p2 -m p2
+      printf 'a\nb\nc\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 to sync with parent, preparing for the problem' \
+    "(cd bar && stg pop --all &&
+      stg pull
+     )
+"
+
+test_expect_failure \
+    'Attempt to push the first of those patches without --merged' \
+    "(cd bar && stg push
+     )
+"
+
+test_expect_success \
+    'Rollback the push' \
+    "(cd bar && stg push --undo
+     )
+"
+
+test_expect_success \
+    'Push those patches while checking they were merged upstream' \
+    "(cd bar && stg push --merged --all
+     )
+"
+
+test_done
Previous: Yann Dirson
Message 2 of 2 in “Updated testcases for stgit pull with merge”
  1. Updated testcases for stgit pull with mergeYann Dirson, Apr 16, 2006
  2. Test that pulls a patch creating a file that got modified afterwardsYann Dirson, Apr 16, 2006

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.