From: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
To: git@vger.kernel.org
Cc: Diane <diane.gasselin@ensimag.imag.fr>,
"Axel Bonnet" <axel.bonnet@ensimag.imag.fr>,
"Clément Poulain" <clement.poulain@ensimag.imag.fr>
Subject: [RFC/ PATCH 5/5] t7609: test merge and checkout error messages
Date: Wed, 9 Jun 2010 14:44:06 +0200 [thread overview]
Message-ID: <1276087446-25112-7-git-send-email-diane.gasselin@ensimag.imag.fr> (raw)
In-Reply-To: <1276087446-25112-6-git-send-email-diane.gasselin@ensimag.imag.fr>
From: Diane <diane.gasselin@ensimag.imag.fr>
Test porcelain and plumbing error messages for different types of errors
of merge and checkout.
Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr>
---
t/t7609-merge-co-error-msgs.sh | 122 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 122 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..8461e10
--- /dev/null
+++ b/t/t7609-merge-co-error-msgs.sh
@@ -0,0 +1,122 @@
+#!/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: Untracked working tree files:
+ two
+ three
+ four
+ five
+would be overwritten by merge.
+EOF
+
+test_expect_success 'untracked files overwritten by merge' '
+ ! git merge branch 2> out &&
+ test_cmp out expect
+'
+
+cat> expect <<EOF
+error: Your local changes to the files:
+ two
+ three
+ four
+would be overwritten by merge.
+Please, commit your changes or stash them before you can merge.
+error: Untracked working tree files:
+ five
+would be overwritten by merge.
+EOF
+
+test_expect_success 'untracked files or local changes ovewritten by merge' '
+ git add two &&
+ git add three &&
+ git add four &&
+ ! git merge branch 2> out &&
+ test_cmp out expect
+'
+
+cat> expect <<EOF
+error: You have local changes to:
+ rep/two
+ rep/one
+cannot 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 &&
+ ! git checkout branch 2> out &&
+ test_cmp out expect
+'
+
+cat> expect <<EOF
+error: Entry 'rep/one' would be overwritten by merge. Cannot merge.
+error: Entry 'rep/two' would be overwritten by merge. Cannot merge.
+EOF
+
+test_expect_success 'not uptodate file plumbing error' '
+ git add rep/one rep/two &&
+ ! git checkout branch 2> out &&
+ test_cmp out expect
+'
+
+cat> expect <<EOF
+error: Updating 'rep' would lose untracked files in it
+error: Updating 'rep2' would lose untracked files in it
+EOF
+
+test_expect_success 'not_uptodate_dir plumbing 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 &&
+ touch rep &&
+ touch rep2 &&
+ git add rep rep2&&
+ git commit -m "added test as a file" &&
+ git checkout master &&
+ touch rep/untracked-file &&
+ touch rep2/untracked-file &&
+ ! git checkout branch 2> out &&
+ test_cmp out ../expect
+'
+
+test_done
--
1.6.6.7.ga5fe3
next prev parent reply other threads:[~2010-06-09 13:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-09 12:44 [RFC/ PATCH 0/5] unpack_trees: nicer error messages Diane Gasselin
2010-06-09 12:44 ` Diane Gasselin
2010-06-09 12:44 ` [RFC/ PATCH 1/5] tree-walk: do not stop when an error is detected Diane Gasselin
2010-06-09 12:44 ` [RFC/ PATCH 2/5] unpack_trees: group errors by type Diane Gasselin
2010-06-09 12:44 ` [RFC/ PATCH 3/5] unpack_trees_options: update porcelain messages Diane Gasselin
2010-06-09 12:44 ` [RFC/ PATCH 4/5] t3030: update porcelain expected message Diane Gasselin
2010-06-09 12:44 ` Diane Gasselin [this message]
2010-06-09 20:47 ` [RFC/ PATCH 5/5] t7609: test merge and checkout error messages Matthieu Moy
2010-06-09 21:10 ` Diane Gasselin
2010-06-09 21:31 ` Matthieu Moy
2010-06-09 16:51 ` [RFC/ PATCH 4/5] t3030: update porcelain expected message Junio C Hamano
2010-06-09 20:40 ` Matthieu Moy
2010-06-10 1:59 ` Jeff King
2010-06-10 7:47 ` Diane Gasselin
2010-06-09 13:19 ` [RFC/ PATCH 2/5] unpack_trees: group errors by type Diane Gasselin
2010-06-09 16:50 ` Junio C Hamano
2010-06-10 9:21 ` Diane Gasselin
2010-06-09 20:59 ` Matthieu Moy
2010-06-09 16:49 ` [RFC/ PATCH 1/5] tree-walk: do not stop when an error is detected Junio C Hamano
2010-06-09 17:18 ` Diane Gasselin
2010-06-09 20:54 ` Matthieu Moy
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276087446-25112-7-git-send-email-diane.gasselin@ensimag.imag.fr \
--to=diane.gasselin@ensimag.imag.fr \
--cc=axel.bonnet@ensimag.imag.fr \
--cc=clement.poulain@ensimag.imag.fr \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).