summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 39ba7d5)
raw | patch | inline | side by side (parent: 39ba7d5)
author | Carl Worth <cworth@cworth.org> | |
Tue, 21 Feb 2006 23:33:49 +0000 (15:33 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 22 Feb 2006 01:33:43 +0000 (17:33 -0800) |
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.
[jc: this should apply to 1.2.X maintenance series, so I reworked
git-ls-files --error-unmatch test. ]
Signed-off-by: Junio C Hamano <junkio@cox.net>
command-line options and file names. It adds documentation and a new
git-add test case as well.
[jc: this should apply to 1.2.X maintenance series, so I reworked
git-ls-files --error-unmatch test. ]
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-add.txt | patch | blob | history | |
git-add.sh | patch | blob | history | |
t/t3700-add.sh | [new file with mode: 0755] | patch | blob |
index 89e461402e6d1476c192daca0c24700707ca432b..7e293834d18982e7ae5d1d6fd057304994978318 100644 (file)
SYNOPSIS
--------
-'git-add' [-n] [-v] <file>...
+'git-add' [-n] [-v] [--] <file>...
DESCRIPTION
-----------
-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 f719b4b1a81a386c9cf62efad811005471be0f8c..611f152daca6fd4ca7a9eab57a9294a26a7924ae 100755 (executable)
--- a/git-add.sh
+++ b/git-add.sh
-v)
verbose=--verbose
;;
+ --)
+ shift
+ break
+ ;;
-*)
usage
;;
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
--- /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 foo | grep foo'
+
+test_expect_success \
+ 'Test that "git-add -- -q" works' \
+ 'touch -- -q && git-add -- -q'
+
+test_done