From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Subject: [PATCH v3 21/31] checkout: convert read_tree_some to take struct pathspec Date: Sun, 13 Jan 2013 19:35:29 +0700 Message-ID: <1358080539-17436-22-git-send-email-pclouds@gmail.com> References: <1358080539-17436-1-git-send-email-pclouds@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano , =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sun Jan 13 13:38:39 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TuMpd-0007rU-4Y for gcvg-git-2@plane.gmane.org; Sun, 13 Jan 2013 13:38:33 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755173Ab3AMMiM convert rfc822-to-quoted-printable (ORCPT ); Sun, 13 Jan 2013 07:38:12 -0500 Received: from mail-pb0-f41.google.com ([209.85.160.41]:32947 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755138Ab3AMMiK (ORCPT ); Sun, 13 Jan 2013 07:38:10 -0500 Received: by mail-pb0-f41.google.com with SMTP id xa7so1691895pbc.14 for ; Sun, 13 Jan 2013 04:38:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=fEJRIdT0zMAf15dRtIS9RrRShsM0htOqITSONnesYLo=; b=NTWnYaNBk/wKgNgYse1uSanZ2oBtfv70bvQXM+ZqqTv7fIWvWRnlL97xZo6FvQYp8o EQ/S33CAYb9Cfv6Ie2W+QCFLVGRjHdofi/YI6gTR9cR6O2nrHr2irWBfQnNB1LZghEkZ a2M7xCO5Gl0v/MP9CCp+GrI2J0xiCiUQuCc8uK8t4Qxc5cWJPD2WplbnbhVDYj9Rm1ZR UKcihdB8rHf0Cqi0OgfUdGjJmFd7gQByDEcqEmty5qfi0nnpovJ3yKNnFRRQqrZ01Qdp TUlXt9CkX6pcu+tpRs2IQsY8DmyQm+79SXi/7B+NZ0M63vmRUc342EoBUur1rxXEDbI3 uGIg== X-Received: by 10.68.220.6 with SMTP id ps6mr244577844pbc.80.1358080690322; Sun, 13 Jan 2013 04:38:10 -0800 (PST) Received: from lanh ([115.74.52.72]) by mx.google.com with ESMTPS id ni8sm6284849pbc.70.2013.01.13.04.38.07 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Jan 2013 04:38:09 -0800 (PST) Received: by lanh (sSMTP sendmail emulation); Sun, 13 Jan 2013 19:38:25 +0700 X-Mailer: git-send-email 1.8.0.rc2.23.g1fb49df In-Reply-To: <1358080539-17436-1-git-send-email-pclouds@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Signed-off-by: Nguy=E1=BB=85n Th=C3=A1i Ng=E1=BB=8Dc Duy --- builtin/checkout.c | 9 +++------ tree.c | 4 ++-- tree.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index 92b11ea..97ea496 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -82,12 +82,9 @@ static int update_some(const unsigned char *sha1, co= nst char *base, int baselen, return 0; } =20 -static int read_tree_some(struct tree *tree, const char **pathspec) +static int read_tree_some(struct tree *tree, const struct pathspec *pa= thspec) { - struct pathspec ps; - init_pathspec(&ps, pathspec); - read_tree_recursive(tree, "", 0, 0, &ps, update_some, NULL); - free_pathspec(&ps); + read_tree_recursive(tree, "", 0, 0, pathspec, update_some, NULL); =20 /* update the index with the given tree's info * for all args, expanding wildcards, and exit @@ -265,7 +262,7 @@ static int checkout_paths(const struct checkout_opt= s *opts, return error(_("corrupt index file")); =20 if (opts->source_tree) - read_tree_some(opts->source_tree, opts->pathspec.raw); + read_tree_some(opts->source_tree, &opts->pathspec); =20 ps_matched =3D xcalloc(1, opts->pathspec.nr); =20 diff --git a/tree.c b/tree.c index 62fed63..ff72f67 100644 --- a/tree.c +++ b/tree.c @@ -47,7 +47,7 @@ static int read_one_entry_quick(const unsigned char *= sha1, const char *base, int } =20 static int read_tree_1(struct tree *tree, struct strbuf *base, - int stage, struct pathspec *pathspec, + int stage, const struct pathspec *pathspec, read_tree_fn_t fn, void *context) { struct tree_desc desc; @@ -116,7 +116,7 @@ static int read_tree_1(struct tree *tree, struct st= rbuf *base, =20 int read_tree_recursive(struct tree *tree, const char *base, int baselen, - int stage, struct pathspec *pathspec, + int stage, const struct pathspec *pathspec, read_tree_fn_t fn, void *context) { struct strbuf sb =3D STRBUF_INIT; diff --git a/tree.h b/tree.h index 69bcb5e..9dc90ba 100644 --- a/tree.h +++ b/tree.h @@ -25,7 +25,7 @@ typedef int (*read_tree_fn_t)(const unsigned char *, = const char *, int, const ch =20 extern int read_tree_recursive(struct tree *tree, const char *base, int baselen, - int stage, struct pathspec *pathspec, + int stage, const struct pathspec *pathspec, read_tree_fn_t fn, void *context); =20 extern int read_tree(struct tree *tree, int stage, struct pathspec *pa= thspec); --=20 1.8.0.rc2.23.g1fb49df