git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 08/12] git-clone: support --path to do sparse clone
Date: Wed, 23 Jul 2008 21:57:18 +0700	[thread overview]
Message-ID: <20080723145718.GA29134@laptop> (raw)


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin-clone.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/builtin-clone.c b/builtin-clone.c
index 3522245..229f2e2 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -36,6 +36,7 @@ static const char * const builtin_clone_usage[] = {
 static int option_quiet, option_no_checkout, option_bare;
 static int option_local, option_no_hardlinks, option_shared;
 static char *option_template, *option_reference, *option_depth;
+static char *option_sparse_prefix;
 static char *option_origin = NULL;
 static char *option_upload_pack = "git-upload-pack";
 
@@ -43,6 +44,8 @@ static struct option builtin_clone_options[] = {
 	OPT__QUIET(&option_quiet),
 	OPT_BOOLEAN('n', "no-checkout", &option_no_checkout,
 		    "don't create a checkout"),
+	OPT_STRING(0, "path", &option_sparse_prefix, "prefixes",
+		    "limit checkout to specified paths (sparse checkout)"),
 	OPT_BOOLEAN(0, "bare", &option_bare, "create a bare repository"),
 	OPT_BOOLEAN(0, "naked", &option_bare, "create a bare repository"),
 	OPT_BOOLEAN('l', "local", &option_local,
@@ -364,9 +367,14 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 			die("--bare and --origin %s options are incompatible.",
 			    option_origin);
 		option_no_checkout = 1;
+		if (option_sparse_prefix)
+			die("--bare and --path options are incompatible.");
 		use_separate_remote = 0;
 	}
 
+	if (option_no_checkout && option_sparse_prefix)
+		die("--no-checkout and --path options are incompatible.");
+
 	if (!option_origin)
 		option_origin = "origin";
 
@@ -549,6 +557,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		/* We need to be in the new work tree for the checkout */
 		setup_work_tree();
 
+		if (option_sparse_prefix) {
+			git_config_set("core.sparsecheckout", option_sparse_prefix);
+			set_sparse_prefix(option_sparse_prefix);
+		}
+
 		fd = hold_locked_index(lock_file, 1);
 
 		memset(&opts, 0, sizeof opts);
-- 
1.5.5.GIT

         reply	other threads:[~2008-07-23 14:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23 14:57 [PATCH 10/12] git-checkout: support --full and --path to manipulate sparse checkout Nguyễn Thái Ngọc Duy
2008-07-23 14:57 ` Nguyễn Thái Ngọc Duy [this message]
2008-07-23 14:56   ` [PATCH 03/12] Introduce sparse prefix Nguyễn Thái Ngọc Duy
2008-07-23 14:55     ` [PATCH 02/12] git-grep: support --no-external-grep Nguyễn Thái Ngọc Duy
2008-07-23 19:01       ` Petr Baudis
2008-07-23 19:05         ` Petr Baudis
2008-07-24 20:26       ` Alex Riesen
2008-07-24 23:16         ` Nguyen Thai Ngoc Duy
2008-07-24 17:19   ` [PATCH 08/12] git-clone: support --path to do sparse clone Jeff King
2008-07-24 17:41     ` sparse fetch, was " Johannes Schindelin
2008-07-24 18:28       ` Jeff King
2008-07-25  0:09         ` Johannes Schindelin
2008-07-25  0:46         ` James Pickens
2008-07-25  0:49           ` sparse fetch, was Re: [PATCH 08/12] git-clone: support --path?to " Jeff King
2008-07-25  8:47         ` sparse fetch, was Re: [PATCH 08/12] git-clone: support --path to " Junio C Hamano
2008-07-25  8:54           ` Sverre Rabbelier
2008-07-24 18:44       ` Nguyen Thai Ngoc Duy
2008-07-24 18:53       ` Petr Baudis
2008-07-24 19:01         ` Sverre Rabbelier
2008-07-25  0:12           ` Johannes Schindelin
2008-07-25  0:42             ` Petr Baudis
2008-07-25  8:14             ` Sverre Rabbelier
2008-07-24 18:47     ` Nguyen Thai Ngoc Duy

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

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

  git send-email \
    --in-reply-to=20080723145718.GA29134@laptop \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).