From: Carl Worth <cworth@cworth.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] git-add: Add support for --, documentation, and test.
Date: Tue, 21 Feb 2006 15:33:49 -0800 [thread overview]
Message-ID: <87pslgs2w2.wl%cworth@cworth.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]
This adds support to git-add to allow the common -- to separate
command-line options and file names. It adds documentation and a new
git-add test case as well.
---
[In my tree on the git-add-dash-dash branch.]
Documentation/git-add.txt | 7 ++++++-
git-add.sh | 4 ++++
t/t3700-add.sh | 22 ++++++++++++++++++++++
3 files changed, 32 insertions(+), 1 deletions(-)
create mode 100755 t/t3700-add.sh
af9363cd7aec2b39ad7ba4594e2c4d4757e8f644
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 89e4614..7e29383 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -7,7 +7,7 @@ git-add - Add files to the index file.
SYNOPSIS
--------
-'git-add' [-n] [-v] <file>...
+'git-add' [-n] [-v] [--] <file>...
DESCRIPTION
-----------
@@ -26,6 +26,11 @@ OPTIONS
-v::
Be verbose.
+--::
+ This option can be used to separate command-line options from
+ the list of files, (useful when filenames might be mistaken
+ for command-line options).
+
DISCUSSION
----------
diff --git a/git-add.sh b/git-add.sh
index 13fad82..d6a4bc7 100755
--- a/git-add.sh
+++ b/git-add.sh
@@ -14,6 +14,10 @@ while : ; do
-v)
verbose=--verbose
;;
+ --)
+ shift
+ break
+ ;;
-*)
usage
;;
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
new file mode 100755
index 0000000..7c61034
--- /dev/null
+++ b/t/t3700-add.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Carl D. Worth
+#
+
+test_description='Test of git-add, including the -- option.'
+
+. ./test-lib.sh
+
+test_expect_success \
+ 'Test of git-add' \
+ 'touch foo && git-add foo'
+
+test_expect_success \
+ 'Post-check that foo is in the index' \
+ 'git-ls-files --error-unmatch foo'
+
+test_expect_success \
+ 'Test that "git-add -- -q" works' \
+ 'touch -- -q && git-add -- -q'
+
+test_done
--
1.2.2.g0a5f5-dirty
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
reply other threads:[~2006-02-21 23:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=87pslgs2w2.wl%cworth@cworth.org \
--to=cworth@cworth.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).