From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org, Erik Sandberg <mandolaerik@gmail.com>
Subject: [StGit PATCH 5/6] New test: conflicting push in dirty worktree
Date: Thu, 20 Mar 2008 01:31:57 +0100 [thread overview]
Message-ID: <20080320003157.13102.10350.stgit@yoghurt> (raw)
In-Reply-To: <20080320002604.13102.53757.stgit@yoghurt>
When the result of a conflicting push can't be represented in the
worktree because the worktree is dirty, the push should be aborted.
Similarly, the push should be aborted if we have to do the merge in
the worktree, but can't because the worktree is dirty.
Add a new test that tests for this. It currently fails, in a bad way:
the contents of the pushed patch is lost.
(The test uses goto instead of push, because push doesn't use the new
infrastructure yet. And old-infrastructure commands never have this
bug, because they refuse to run with a dirty worktree.)
This bug was found by Erik Sandberg <mandolaerik@gmail.com>, who also
came up with the minimal test case that I turned into this new test.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t3000-dirty-merge.sh | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
create mode 100755 t/t3000-dirty-merge.sh
diff --git a/t/t3000-dirty-merge.sh b/t/t3000-dirty-merge.sh
new file mode 100755
index 0000000..dd81c9e
--- /dev/null
+++ b/t/t3000-dirty-merge.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+test_description='Try a push that requires merging a file that is dirty'
+
+. ./test-lib.sh
+
+test_expect_success 'Initialize StGit stack with two patches' '
+ stg init &&
+ touch a &&
+ git add a &&
+ git commit -m a &&
+ echo 1 > a &&
+ git commit -a -m p1 &&
+ echo 2 > a &&
+ git commit -a -m p2 &&
+ stg uncommit -n 2
+'
+
+test_expect_success 'Pop one patch and update the other' '
+ stg goto p1 &&
+ echo 3 > a &&
+ stg refresh
+'
+
+test_expect_failure 'Push with dirty worktree' '
+ echo 4 > a &&
+ [ "$(echo $(stg applied))" = "p1" ] &&
+ [ "$(echo $(stg unapplied))" = "p2" ] &&
+ ! stg goto p2 &&
+ [ "$(echo $(stg applied))" = "p1" ] &&
+ [ "$(echo $(stg unapplied))" = "p2" ] &&
+ [ "$(echo $(cat a))" = "4" ]
+'
+
+test_done
next prev parent reply other threads:[~2008-03-20 0:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-20 0:31 [StGit PATCH 0/6] Two bugfixes Karl Hasselström
2008-03-20 0:31 ` [StGit PATCH 1/6] Use a special exit code for bugs Karl Hasselström
2008-03-20 0:31 ` [StGit PATCH 2/6] Make sure patches with no parents have an empty list of parents Karl Hasselström
2008-03-20 0:31 ` [StGit PATCH 3/6] Try uncommitting a commit with not exactly one parent Karl Hasselström
2008-03-20 0:31 ` [StGit PATCH 4/6] Make sure that we only uncommit commits with " Karl Hasselström
2008-03-20 0:31 ` Karl Hasselström [this message]
2008-03-20 0:32 ` [StGit PATCH 6/6] Handle failed pushes differently depending on cause Karl Hasselström
2008-03-20 15:19 ` [StGit PATCH 0/6] Two bugfixes Catalin Marinas
2008-03-24 8:35 ` Karl Hasselström
2008-03-24 9:16 ` Catalin Marinas
2008-03-24 18:12 ` Karl Hasselström
2008-03-25 10:46 ` Catalin Marinas
2008-03-25 11:05 ` Karl Hasselström
2008-03-25 15:27 ` Catalin Marinas
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=20080320003157.13102.10350.stgit@yoghurt \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
--cc=mandolaerik@gmail.com \
/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).