From: Jonas Fonseca Date: Mon, 6 Jun 2005 21:27:00 +0000 (+0200) Subject: [PATCH] git-diff-cache: handle pathspec beginning with a dash X-Git-Tag: v0.99~310 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e0f0e891c1742c6ae22dbc648a1000ad8655ff34;p=git.git [PATCH] git-diff-cache: handle pathspec beginning with a dash Parse everything after '--' as tree name or pathspec. Signed-off-by: Jonas Fonseca Signed-off-by: Linus Torvalds --- diff --git a/diff-cache.c b/diff-cache.c index e95fd70d..1d355aa0 100644 --- a/diff-cache.c +++ b/diff-cache.c @@ -167,13 +167,14 @@ int main(int argc, const char **argv) void *tree; unsigned long size; int ret; + int allow_options = 1; int i; read_cache(); for (i = 1; i < argc; i++) { const char *arg = argv[i]; - if (*arg != '-') { + if (!allow_options || *arg != '-') { if (tree_name) { pathspec = argv + i; break; @@ -182,6 +183,10 @@ int main(int argc, const char **argv) continue; } + if (!strcmp(arg, "--")) { + allow_options = 0; + continue; + } if (!strcmp(arg, "-r")) { /* We accept the -r flag just to look like git-diff-tree */ continue;