From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Diane Gasselin <diane.gasselin@ensimag.imag.fr>,
Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH 5/5] t7609: test merge and checkout error messages
Date: Mon, 9 Aug 2010 16:20:02 +0200 [thread overview]
Message-ID: <1281363602-27856-6-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1281363602-27856-1-git-send-email-Matthieu.Moy@imag.fr>
From: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Test porcelain and plumbing error messages for different types of errors
of merge and checkout.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
t/t7609-merge-co-error-msgs.sh | 125 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 125 insertions(+), 0 deletions(-)
create mode 100755 t/t7609-merge-co-error-msgs.sh
diff --git a/t/t7609-merge-co-error-msgs.sh b/t/t7609-merge-co-error-msgs.sh
new file mode 100755
index 0000000..1a109b4
--- /dev/null
+++ b/t/t7609-merge-co-error-msgs.sh
@@ -0,0 +1,125 @@
+#!/bin/sh
+
+test_description='unpack-trees error messages'
+
+. ./test-lib.sh
+
+
+test_expect_success 'setup' '
+ echo one >one &&
+ git add one &&
+ git commit -a -m First &&
+
+ git checkout -b branch &&
+ echo two >two &&
+ echo three >three &&
+ echo four >four &&
+ echo five >five &&
+ git add two three four five &&
+ git commit -m Second &&
+
+ git checkout master &&
+ echo other >two &&
+ echo other >three &&
+ echo other >four &&
+ echo other >five
+'
+
+cat >expect <<\EOF
+error: The following untracked working tree files would be overwritten by merge:
+ two
+ three
+ four
+ five
+Please move or remove them before you can merge.
+EOF
+
+test_expect_success 'untracked files overwritten by merge' '
+ test_must_fail git merge branch 2>out &&
+ test_cmp out expect
+'
+
+cat >expect <<\EOF
+error: Your local changes to the following files would be overwritten by merge:
+ two
+ three
+ four
+Please, commit your changes or stash them before you can merge.
+error: The following untracked working tree files would be overwritten by merge:
+ five
+Please move or remove them before you can merge.
+EOF
+
+test_expect_success 'untracked files or local changes ovewritten by merge' '
+ git add two &&
+ git add three &&
+ git add four &&
+ test_must_fail git merge branch 2>out &&
+ test_cmp out expect
+'
+
+cat >expect <<\EOF
+error: Your local changes to the following files would be overwritten by checkout:
+ rep/two
+ rep/one
+Please, commit your changes or stash them before you can switch branches.
+EOF
+
+test_expect_success 'cannot switch branches because of local changes' '
+ git add five &&
+ mkdir rep &&
+ echo one >rep/one &&
+ echo two >rep/two &&
+ git add rep/one rep/two &&
+ git commit -m Fourth &&
+ git checkout master &&
+ echo uno >rep/one &&
+ echo dos >rep/two &&
+ test_must_fail git checkout branch 2>out &&
+ test_cmp out expect
+'
+
+cat >expect <<\EOF
+error: Your local changes to the following files would be overwritten by checkout:
+ rep/two
+ rep/one
+Please, commit your changes or stash them before you can switch branches.
+EOF
+
+test_expect_success 'not uptodate file porcelain checkout error' '
+ git add rep/one rep/two &&
+ test_must_fail git checkout branch 2>out &&
+ test_cmp out expect
+'
+
+cat >expect <<\EOF
+error: Updating the following directories would lose untracked files in it:
+ rep2
+ rep
+
+EOF
+
+test_expect_success 'not_uptodate_dir porcelain checkout error' '
+ git init uptodate &&
+ cd uptodate &&
+ mkdir rep &&
+ mkdir rep2 &&
+ touch rep/foo &&
+ touch rep2/foo &&
+ git add rep/foo rep2/foo &&
+ git commit -m init &&
+ git checkout -b branch &&
+ git rm rep -r &&
+ git rm rep2 -r &&
+ >rep &&
+ >rep2 &&
+ git add rep rep2&&
+ git commit -m "added test as a file" &&
+ git checkout master &&
+ >rep/untracked-file &&
+ >rep2/untracked-file &&
+ test_must_fail git checkout branch 2>out &&
+ test_cmp out ../expect
+'
+
+test_done
--
1.7.2.1.52.g95e25.dirty
prev parent reply other threads:[~2010-08-09 14:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-09 14:19 [PATCH 0/5] Better error messages for checkout and merge Matthieu Moy
2010-08-09 14:19 ` [PATCH 1/5] Turn unpack_trees_options.msgs into an array + enum Matthieu Moy
2010-08-09 19:47 ` Junio C Hamano
2010-08-09 20:49 ` Matthieu Moy
2010-08-11 8:38 ` [PATCH 1/5 v2] " Matthieu Moy
2010-08-11 8:38 ` [PATCH 2/5 v2] merge-recursive: porcelain messages for checkout Matthieu Moy
2010-08-11 8:38 ` [PATCH 3/5 v2] merge-recursive: distinguish "removed" and "overwritten" messages Matthieu Moy
2010-08-11 8:38 ` [PATCH 4/5 v2] unpack_trees: group error messages by type Matthieu Moy
2010-08-11 8:38 ` [PATCH 5/5 v2] t7609: test merge and checkout error messages Matthieu Moy
2010-08-09 14:19 ` [PATCH 2/5] merge-recursive: porcelain messages for checkout Matthieu Moy
2010-08-09 19:58 ` Junio C Hamano
2010-08-09 20:52 ` Matthieu Moy
2010-08-09 21:15 ` Ævar Arnfjörð Bjarmason
2010-08-09 14:20 ` [PATCH 3/5] merge-recursive: distinguish "removed" and "overwritten" messages Matthieu Moy
2010-08-09 14:20 ` [PATCH 4/5] unpack_trees: group error messages by type Matthieu Moy
2010-08-09 14:20 ` Matthieu Moy [this message]
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=1281363602-27856-6-git-send-email-Matthieu.Moy@imag.fr \
--to=matthieu.moy@imag.fr \
--cc=diane.gasselin@ensimag.imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).