[PATCH] git-diff-cache: handle pathspec beginning with a dash
Parse everything after '--' as tree name or pathspec. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
2a68a8659f
commit
e0f0e891c1
@ -167,13 +167,14 @@ int main(int argc, const char **argv)
|
|||||||
void *tree;
|
void *tree;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
int ret;
|
int ret;
|
||||||
|
int allow_options = 1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
read_cache();
|
read_cache();
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
const char *arg = argv[i];
|
const char *arg = argv[i];
|
||||||
|
|
||||||
if (*arg != '-') {
|
if (!allow_options || *arg != '-') {
|
||||||
if (tree_name) {
|
if (tree_name) {
|
||||||
pathspec = argv + i;
|
pathspec = argv + i;
|
||||||
break;
|
break;
|
||||||
@ -182,6 +183,10 @@ int main(int argc, const char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(arg, "--")) {
|
||||||
|
allow_options = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcmp(arg, "-r")) {
|
if (!strcmp(arg, "-r")) {
|
||||||
/* We accept the -r flag just to look like git-diff-tree */
|
/* We accept the -r flag just to look like git-diff-tree */
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user