summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b060ce7)
raw | patch | inline | side by side (parent: b060ce7)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 May 2011 04:34:04 +0000 (21:34 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 May 2011 19:11:01 +0000 (12:11 -0700) |
When there is no remaining string in argv, get_pathspec(prefix, argv)
will return a two-element array that has prefix as the first element,
so there is no need to re-roll that logic in the code that uses
get_pathspec().
Signed-off-by: Junio C Hamano <gitster@pobox.com>
will return a two-element array that has prefix as the first element,
so there is no need to re-roll that logic in the code that uses
get_pathspec().
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c | patch | blob | history |
diff --git a/builtin/grep.c b/builtin/grep.c
index 0bf8c0116a6a4c178a2c368f17d4103e91486624..222dd6d9afa98d02fc661926732620bc65d0881d 100644 (file)
--- a/builtin/grep.c
+++ b/builtin/grep.c
verify_filename(prefix, argv[j]);
}
- if (i < argc)
- paths = get_pathspec(prefix, argv + i);
- else if (prefix) {
- paths = xcalloc(2, sizeof(const char *));
- paths[0] = prefix;
- paths[1] = NULL;
- }
+ paths = get_pathspec(prefix, argv + i);
init_pathspec(&pathspec, paths);
pathspec.max_depth = opt.max_depth;
pathspec.recursive = 1;