From 500b97e4bb184c954a52550843e6314ecf97a208 Mon Sep 17 00:00:00 2001 From: Fredrik Kuivinen Date: Sun, 2 Oct 2005 17:33:38 +0200 Subject: [PATCH] Teach git-ls-files about '--' to denote end of options. Useful if you have a file whose name starts with a dash. Signed-off-by: Fredrik Kuivinen Signed-off-by: Junio C Hamano --- ls-files.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ls-files.c') diff --git a/ls-files.c b/ls-files.c index 956be09350..f47114a168 100644 --- a/ls-files.c +++ b/ls-files.c @@ -530,7 +530,7 @@ static void verify_pathspec(void) static const char ls_files_usage[] = "git-ls-files [-z] [-t] (--[cached|deleted|others|stage|unmerged|killed|modified])* " "[ --ignored ] [--exclude=] [--exclude-from=] " - "[ --exclude-per-directory= ]"; + "[ --exclude-per-directory= ] [--] []*"; int main(int argc, const char **argv) { @@ -544,6 +544,10 @@ int main(int argc, const char **argv) for (i = 1; i < argc; i++) { const char *arg = argv[i]; + if (!strcmp(arg, "--")) { + i++; + break; + } if (!strcmp(arg, "-z")) { line_terminator = 0; continue; -- cgit v1.2.1