File tree Expand file tree Collapse file tree 3 files changed +82
-2
lines changed Expand file tree Collapse file tree 3 files changed +82
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ SYNOPSIS
13
13
(-[c|d|o|i|s|u|k|m])\*
14
14
[-x <pattern>|--exclude=<pattern>]
15
15
[-X <file>|--exclude-from=<file>]
16
- [--exclude-per-directory=<file>]
16
+ [--exclude-per-directory=<file>] [--] [<file>]\*
17
17
18
18
DESCRIPTION
19
19
-----------
@@ -77,6 +77,13 @@ OPTIONS
77
77
K to be killed
78
78
? other
79
79
80
+ --::
81
+ Do not interpret any more arguments as options.
82
+
83
+ <file>::
84
+ Files to show. If no files are given all files which match the other
85
+ specified criteria are shown.
86
+
80
87
Output
81
88
------
82
89
show files just outputs the filename unless '--stage' is specified in
Original file line number Diff line number Diff line change @@ -530,7 +530,7 @@ static void verify_pathspec(void)
530
530
static const char ls_files_usage [] =
531
531
"git-ls-files [-z] [-t] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
532
532
"[ --ignored ] [--exclude=<pattern>] [--exclude-from=<file>] "
533
- "[ --exclude-per-directory=<filename> ]" ;
533
+ "[ --exclude-per-directory=<filename> ] [--] [<file>]* " ;
534
534
535
535
int main (int argc , const char * * argv )
536
536
{
@@ -544,6 +544,10 @@ int main(int argc, const char **argv)
544
544
for (i = 1 ; i < argc ; i ++ ) {
545
545
const char * arg = argv [i ];
546
546
547
+ if (!strcmp (arg , "--" )) {
548
+ i ++ ;
549
+ break ;
550
+ }
547
551
if (!strcmp (arg , "-z" )) {
548
552
line_terminator = 0 ;
549
553
continue ;
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # Copyright (c) 2005 Junio C Hamano
4
+ #
5
+
6
+ test_description=' git-ls-files test (-- to terminate the path list).
7
+
8
+ This test runs git-ls-files --others with the following on the
9
+ filesystem.
10
+
11
+ path0 - a file
12
+ -foo - a file with a funny name.
13
+ -- - another file with a funny name.
14
+ '
15
+ . ./test-lib.sh
16
+
17
+ test_expect_success \
18
+ setup \
19
+ ' echo frotz >path0 &&
20
+ echo frotz >./-foo &&
21
+ echo frotz >./--'
22
+
23
+ test_expect_success \
24
+ ' git-ls-files without path restriction.' \
25
+ ' git-ls-files --others >output &&
26
+ diff -u output - <<EOF
27
+ --
28
+ -foo
29
+ output
30
+ path0
31
+ EOF
32
+ '
33
+
34
+ test_expect_success \
35
+ ' git-ls-files with path restriction.' \
36
+ ' git-ls-files --others path0 >output &&
37
+ diff -u output - <<EOF
38
+ path0
39
+ EOF
40
+ '
41
+
42
+ test_expect_success \
43
+ ' git-ls-files with path restriction with --.' \
44
+ ' git-ls-files --others -- path0 >output &&
45
+ diff -u output - <<EOF
46
+ path0
47
+ EOF
48
+ '
49
+
50
+ test_expect_success \
51
+ ' git-ls-files with path restriction with -- --.' \
52
+ ' git-ls-files --others -- -- >output &&
53
+ diff -u output - <<EOF
54
+ --
55
+ EOF
56
+ '
57
+
58
+ test_expect_success \
59
+ ' git-ls-files with no path restriction.' \
60
+ ' git-ls-files --others -- >output &&
61
+ diff -u output - <<EOF
62
+ --
63
+ -foo
64
+ output
65
+ path0
66
+ EOF
67
+ '
68
+
69
+ test_done
You can’t perform that action at this time.
0 commit comments