From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH v2 3/4] git-add --all: tests
Date: Sat, 19 Jul 2008 23:09:03 -0700 [thread overview]
Message-ID: <1216534144-23826-3-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1216534144-23826-2-git-send-email-gitster@pobox.com>
And here is a small test script that makes sure that:
- both modified and new files are included,
- removed file is noticed, and
- no ignored file is included.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This option has to be a superset of -u, so it must also notice removed
files. v2 adds that to the test.
t/t2202-add-addremove.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
create mode 100755 t/t2202-add-addremove.sh
diff --git a/t/t2202-add-addremove.sh b/t/t2202-add-addremove.sh
new file mode 100755
index 0000000..6a81510
--- /dev/null
+++ b/t/t2202-add-addremove.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+test_description='git add --all'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ (
+ echo .gitignore
+ echo will-remove
+ ) >expect &&
+ (
+ echo actual
+ echo expect
+ echo ignored
+ ) >.gitignore &&
+ >will-remove &&
+ git add --all &&
+ test_tick &&
+ git commit -m initial &&
+ git ls-files >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git add --all' '
+ (
+ echo .gitignore
+ echo not-ignored
+ echo "M .gitignore"
+ echo "A not-ignored"
+ echo "D will-remove"
+ ) >expect &&
+ >ignored &&
+ >not-ignored &&
+ echo modification >>.gitignore &&
+ rm -f will-remove &&
+ git add --all &&
+ git update-index --refresh &&
+ git ls-files >actual &&
+ git diff-index --name-status --cached HEAD >>actual &&
+ test_cmp expect actual
+'
+
+test_done
--
1.5.6.4.570.g052e6
next prev parent reply other threads:[~2008-07-20 6:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-20 6:09 [PATCH v2 1/4] builtin-add.c: restructure the code for maintainability Junio C Hamano
2008-07-20 6:09 ` [PATCH v2 2/4] git-add --all: add all files Junio C Hamano
2008-07-20 6:09 ` Junio C Hamano [this message]
2008-07-20 6:09 ` [PATCH v2 4/4] git-add --all: documentation Junio C Hamano
2008-07-21 0:56 ` [PATCH v2 1/4] builtin-add.c: restructure the code for maintainability Johannes Schindelin
2008-07-21 0:58 ` [PATCH/RFC] git add: do not add files from a submodule Johannes Schindelin
2008-07-22 21:32 ` Johannes Schindelin
2008-07-23 6:40 ` Junio C Hamano
2008-07-23 8:13 ` Pierre Habouzit
2008-07-23 18:31 ` Junio C Hamano
2008-07-23 19:02 ` Pierre Habouzit
2008-07-23 19:10 ` Johannes Schindelin
2008-07-23 19:11 ` Pierre Habouzit
2008-07-21 5:22 ` [PATCH v2 1/4] builtin-add.c: restructure the code for maintainability Junio C Hamano
2008-07-21 7:52 ` Junio C Hamano
2008-07-21 8:24 ` Junio C Hamano
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=1216534144-23826-3-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--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).