@matheusbsbs / matheus-bagliano / commits / 60ace8790f
Fork 0

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>

Carl Worth committed Feb 21, 2006 at 15:33 UTC 60ace8790f3cfba4fdc16e71e23c4f9c44ce9b44
3 files changed +32 -1
Documentation/git-add.txt
+6 -1
@@ -7,7 +7,7 @@ git-add - Add files to the index file.
7
8 SYNOPSIS
9 --------
10 -'git-add' [-n] [-v] <file>...
10 +'git-add' [-n] [-v] [--] <file>...
11
12 DESCRIPTION
13 -----------
@@ -26,6 +26,11 @@ OPTIONS
26 -v::
27 Be verbose.
28
29 +--::
30 + This option can be used to separate command-line options from
31 + the list of files, (useful when filenames might be mistaken
32 + for command-line options).
33 +
34
35 DISCUSSION
36 ----------
git-add.sh
+4
@@ -14,6 +14,10 @@ while : ; do
14 -v)
15 verbose=--verbose
16 ;;
17 + --)
18 + shift
19 + break
20 + ;;
21 -*)
22 usage
23 ;;
t/t3700-add.sh new
+22
@@ -0,0 +1,22 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2006 Carl D. Worth
4 +#
5 +
6 +test_description='Test of git-add, including the -- option.'
7 +
8 +. ./test-lib.sh
9 +
10 +test_expect_success \
11 + 'Test of git-add' \
12 + 'touch foo && git-add foo'
13 +
14 +test_expect_success \
15 + 'Post-check that foo is in the index' \
16 + 'git-ls-files foo | grep foo'
17 +
18 +test_expect_success \
19 + 'Test that "git-add -- -q" works' \
20 + 'touch -- -q && git-add -- -q'
21 +
22 +test_done