git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Michael J Gruber <git@drmicha.warpmail.net>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 5/5] grep: convert to use the new get_pathspec()
Date: Sat,  9 Apr 2011 23:54:20 +0700	[thread overview]
Message-ID: <1302368060-23827-6-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1302368060-23827-1-git-send-email-pclouds@gmail.com>

---
 builtin/grep.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/builtin/grep.c b/builtin/grep.c
index 2826ca8..af16deb 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -734,7 +734,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	const char *show_in_pager = NULL, *default_pager = "dummy";
 	struct grep_opt opt;
 	struct object_array list = OBJECT_ARRAY_INIT;
-	const char **paths = NULL;
 	struct pathspec pathspec;
 	struct string_list path_list = STRING_LIST_INIT_NODUP;
 	int i;
@@ -956,14 +955,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 			verify_filename(prefix, argv[j]);
 	}
 
-	if (i < argc)
-		paths = get_pathspec_old(prefix, argv + i);
-	else if (prefix) {
-		paths = xcalloc(2, sizeof(const char *));
-		paths[0] = prefix;
-		paths[1] = NULL;
-	}
-	init_pathspec(&pathspec, paths);
+	get_pathspec(&pathspec, prefix, argc - i, argv + i);
 	pathspec.max_depth = opt.max_depth;
 	pathspec.recursive = 1;
 
-- 
1.7.4.74.g639db

  parent reply	other threads:[~2011-04-09 16:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 16:54 [PATCH 0/5] New get_pathspec() Nguyễn Thái Ngọc Duy
2011-04-09 16:54 ` [PATCH 1/5] Rename functions in preparation for get_pathspec() restructure Nguyễn Thái Ngọc Duy
2011-04-09 16:54 ` [PATCH 2/5] Replace has_wildcard with PATHSPEC_NOGLOB Nguyễn Thái Ngọc Duy
2011-04-10  0:49   ` Junio C Hamano
2011-04-10  7:23     ` Nguyen Thai Ngoc Duy
2011-04-09 16:54 ` [PATCH 3/5] Convert prefix_pathspec() to produce struct pathspec_item Nguyễn Thái Ngọc Duy
2011-04-09 16:54 ` [PATCH 4/5] Implement new get_pathspec() Nguyễn Thái Ngọc Duy
2011-04-09 16:54 ` Nguyễn Thái Ngọc Duy [this message]
2011-04-10  0:56   ` [PATCH 5/5] grep: convert to use the " Junio C Hamano
2011-04-10  7:26     ` Nguyen Thai Ngoc Duy
2011-04-09 21:41 ` [PATCH 0/5] New get_pathspec() Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302368060-23827-6-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).