Browse Source

git-add: Add support for --, documentation, and test.

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>
maint
Carl Worth 19 years ago committed by Junio C Hamano
parent
commit
60ace8790f
  1. 7
      Documentation/git-add.txt
  2. 4
      git-add.sh
  3. 22
      t/t3700-add.sh

7
Documentation/git-add.txt

@ -7,7 +7,7 @@ git-add - Add files to the index file. @@ -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 @@ -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
----------

4
git-add.sh

@ -14,6 +14,10 @@ while : ; do @@ -14,6 +14,10 @@ while : ; do
-v)
verbose=--verbose
;;
--)
shift
break
;;
-*)
usage
;;

22
t/t3700-add.sh

@ -0,0 +1,22 @@ @@ -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
Loading…
Cancel
Save