git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <newren@gmail.com>
To: git@vger.kernel.org
Cc: pclouds@gmail.com, Elijah Newren <newren@gmail.com>
Subject: [RFC PATCH 12/15] Pass extra (rev-list) args on, at least in some cases
Date: Sat,  4 Sep 2010 18:14:04 -0600	[thread overview]
Message-ID: <1283645647-1891-13-git-send-email-newren@gmail.com> (raw)
In-Reply-To: <1283645647-1891-1-git-send-email-newren@gmail.com>


Signed-off-by: Elijah Newren <newren@gmail.com>
---
 builtin/archive.c    |    2 +-
 builtin/clone.c      |    2 +-
 builtin/fetch-pack.c |    3 ++-
 builtin/send-pack.c  |    3 ++-
 cache.h              |    2 +-
 connect.c            |    9 ++++++++-
 transport-helper.c   |    5 ++++-
 transport.c          |   13 +++++++++----
 transport.h          |    8 +++++---
 9 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/builtin/archive.c b/builtin/archive.c
index 6a887f5..018d2b6 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -35,7 +35,7 @@ static int run_remote_archiver(int argc, const char **argv,
 	if (!_remote->url[0])
 		die("git archive: Remote with no URL");
 	transport = transport_get(_remote, _remote->url[0]);
-	transport_connect(transport, "git-upload-archive", exec, fd);
+	transport_connect(transport, "git-upload-archive", exec, NULL, fd);
 
 	for (i = 1; i < argc; i++)
 		packet_write(fd[1], "argument %s\n", argv[i]);
diff --git a/builtin/clone.c b/builtin/clone.c
index de0fb66..5c0f594 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -545,7 +545,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 			int ret;
 
 			sq_quote_argv(&buf, &argv[rest_argc], 0);
-			ret = transport_set_option(transport, TRANS_OPT_SPARSE,
+			ret = transport_set_option(transport, TRANS_OPT_REVLIST_ARGS,
 						   strbuf_detach(&buf, NULL));
 			if (ret)
 				warning ("Sparse clone not supported!\n");
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index dbd8b7b..e550f3d 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -875,7 +875,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
 		fd[0] = 0;
 		fd[1] = 1;
 	} else {
-		conn = git_connect(fd, (char *)dest, args.uploadpack,
+		error("Should pass extra_args to git_connect!");
+		conn = git_connect(fd, (char *)dest, args.uploadpack, NULL,
 				   args.verbose ? CONNECT_VERBOSE : 0);
 	}
 
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 481602d..c3ae328 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -478,7 +478,8 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
 		fd[0] = 0;
 		fd[1] = 1;
 	} else {
-		conn = git_connect(fd, dest, receivepack,
+		error("Should pass extra_args to git_connect!");
+		conn = git_connect(fd, dest, receivepack, NULL,
 			args.verbose ? CONNECT_VERBOSE : 0);
 	}
 
diff --git a/cache.h b/cache.h
index 6f88dbb..84c0969 100644
--- a/cache.h
+++ b/cache.h
@@ -937,7 +937,7 @@ extern struct ref *find_ref_by_name(const struct ref *list, const char *name);
 
 #define CONNECT_VERBOSE       (1u << 0)
 extern char *git_getpass(const char *prompt);
-extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);
+extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, const char *extra_args, int flags);
 extern int finish_connect(struct child_process *conn);
 extern int path_match(const char *path, int nr, char **match);
 struct extra_have_objects {
diff --git a/connect.c b/connect.c
index 3450cab..42135c8 100644
--- a/connect.c
+++ b/connect.c
@@ -449,7 +449,8 @@ static struct child_process no_fork;
  * the connection failed).
  */
 struct child_process *git_connect(int fd[2], const char *url_orig,
-				  const char *prog, int flags)
+				  const char *prog, const char *extra_args,
+				  int flags)
 {
 	char *url;
 	char *host, *path;
@@ -550,6 +551,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 		 * Note: Do not add any other headers here!  Doing so
 		 * will cause older git-daemon servers to crash.
 		 */
+		if (extra_args)
+			error("What to do with extra_args?!?\n");
 		packet_write(fd[1],
 			     "%s %s%chost=%s%c",
 			     prog, path, 0,
@@ -567,6 +570,10 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 	strbuf_addstr(&cmd, prog);
 	strbuf_addch(&cmd, ' ');
 	sq_quote_buf(&cmd, path);
+	if (extra_args) {
+		strbuf_addch(&cmd, ' ');
+		strbuf_addstr(&cmd, extra_args);
+	}
 	if (cmd.len >= MAX_CMD_LEN)
 		die("command line too long");
 
diff --git a/transport-helper.c b/transport-helper.c
index af81fe1..c2b6db3 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -509,7 +509,7 @@ static int process_connect(struct transport *transport,
 }
 
 static int connect_helper(struct transport *transport, const char *name,
-		   const char *exec, int fd[2])
+			  const char *exec, const char *extra_args, int fd[2])
 {
 	struct helper_data *data = transport->data;
 
@@ -518,6 +518,9 @@ static int connect_helper(struct transport *transport, const char *name,
 	if (!data->connect)
 		die("Operation not supported by protocol.");
 
+	if (extra_args)
+		die("extra_args not handled!!!!  OH NOES!!!");
+
 	if (!process_connect_service(transport, name, exec))
 		die("Can't connect to subservice %s.", name);
 
diff --git a/transport.c b/transport.c
index 4dba6f8..1d3cab3 100644
--- a/transport.c
+++ b/transport.c
@@ -475,6 +475,9 @@ static int set_git_option(struct git_transport_options *opts,
 		else
 			opts->depth = atoi(value);
 		return 0;
+	} else if (!strcmp(name, TRANS_OPT_REVLIST_ARGS)) {
+		opts->revlist_args = value;
+		return 0;
 	}
 	return 1;
 }
@@ -489,6 +492,7 @@ static int connect_setup(struct transport *transport, int for_push, int verbose)
 	data->conn = git_connect(data->fd, transport->url,
 				 for_push ? data->options.receivepack :
 				 data->options.uploadpack,
+				 data->options.revlist_args,
 				 verbose ? CONNECT_VERBOSE : 0);
 
 	return 0;
@@ -805,11 +809,12 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
 }
 
 static int connect_git(struct transport *transport, const char *name,
-		       const char *executable, int fd[2])
+		       const char *executable, const char *extra_args,
+		       int fd[2])
 {
 	struct git_transport_data *data = transport->data;
 	data->conn = git_connect(data->fd, transport->url,
-				 executable, 0);
+				 executable, extra_args, 0);
 	fd[0] = data->fd[0];
 	fd[1] = data->fd[1];
 	return 0;
@@ -1124,10 +1129,10 @@ void transport_unlock_pack(struct transport *transport)
 }
 
 int transport_connect(struct transport *transport, const char *name,
-		      const char *exec, int fd[2])
+		      const char *exec, const char *extra_args, int fd[2])
 {
 	if (transport->connect)
-		return transport->connect(transport, name, exec, fd);
+		return transport->connect(transport, name, exec, extra_args, fd);
 	else
 		die("Operation not supported by protocol");
 }
diff --git a/transport.h b/transport.h
index 41e347a..2669e84 100644
--- a/transport.h
+++ b/transport.h
@@ -11,6 +11,7 @@ struct git_transport_options {
 	int depth;
 	const char *uploadpack;
 	const char *receivepack;
+	const char *revlist_args;
 };
 
 struct transport {
@@ -71,7 +72,8 @@ struct transport {
 	int (*push_refs)(struct transport *transport, struct ref *refs, int flags);
 	int (*push)(struct transport *connection, int refspec_nr, const char **refspec, int flags);
 	int (*connect)(struct transport *connection, const char *name,
-		       const char *executable, int fd[2]);
+		       const char *executable, const char *extra_args,
+		       int fd[2]);
 
 	/** get_refs_list(), fetch(), and push_refs() can keep
 	 * resources (such as a connection) reserved for futher
@@ -128,7 +130,7 @@ struct transport *transport_get(struct remote *, const char *);
 #define TRANS_OPT_FOLLOWTAGS "followtags"
 
 /* Fetch only certain paths */
-#define TRANS_OPT_SPARSE "sparse"
+#define TRANS_OPT_REVLIST_ARGS "revlist_args"
 
 /**
  * Returns 0 if the option was used, non-zero otherwise. Prints a
@@ -153,7 +155,7 @@ void transport_take_over(struct transport *transport,
 			 struct child_process *child);
 
 int transport_connect(struct transport *transport, const char *name,
-		      const char *exec, int fd[2]);
+		      const char *exec, const char *extra_args, int fd[2]);
 
 /* Transport methods defined outside transport.c */
 int transport_helper_init(struct transport *transport, const char *name);
-- 
1.7.2.2.140.gd06af

  parent reply	other threads:[~2010-09-05  0:13 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-05  0:13 [RFC PATCH 00/15] Sparse clones Elijah Newren
2010-09-05  0:13 ` [RFC PATCH 01/15] README-sparse-clone: Add a basic writeup of my ideas for sparse clones Elijah Newren
2010-09-05  3:01   ` Nguyen Thai Ngoc Duy
2010-09-05  3:13     ` Elijah Newren
2010-09-06  3:14       ` Nguyen Thai Ngoc Duy
2010-09-05  0:13 ` [RFC PATCH 02/15] Add tests for client handling in a sparse repository Elijah Newren
2010-09-05  0:13 ` [RFC PATCH 03/15] Read sparse limiting args from $GIT_DIR/sparse-limit Elijah Newren
2010-09-05  0:13 ` [RFC PATCH 04/15] When unpacking in a sparse repository, avoid traversing missing trees/blobs Elijah Newren
2010-09-05  0:13 ` [RFC PATCH 05/15] read_tree_recursive: Avoid missing blobs and trees in a sparse repository Elijah Newren
2010-09-05  2:00   ` Nguyen Thai Ngoc Duy
2010-09-05  3:16     ` Elijah Newren
2010-09-05  4:31       ` Elijah Newren
2010-09-05  0:13 ` [RFC PATCH 06/15] Automatically reuse sparse limiting arguments in revision walking Elijah Newren
2010-09-05  1:58   ` Nguyen Thai Ngoc Duy
2010-09-05  4:50     ` Elijah Newren
2010-09-05  7:12       ` Nguyen Thai Ngoc Duy
2010-09-05  0:13 ` [RFC PATCH 07/15] cache_tree_update(): Capability to handle tree entries missing from index Elijah Newren
2010-09-05  7:54   ` Nguyen Thai Ngoc Duy
2010-09-05 21:09     ` Elijah Newren
2010-09-06  4:42       ` Elijah Newren
2010-09-06  5:02         ` Nguyen Thai Ngoc Duy
2010-09-06  4:47   ` [PATCH 0/4] en/object-list-with-pathspec update Nguyễn Thái Ngọc Duy
2010-09-06  4:47   ` [PATCH 1/4] Add testcases showing how pathspecs are ignored with rev-list --objects Nguyễn Thái Ngọc Duy
2010-09-06  4:47   ` [PATCH 2/4] tree-walk: copy tree_entry_interesting() as is from tree-diff.c Nguyễn Thái Ngọc Duy
2010-09-06 15:22     ` Elijah Newren
2010-09-06 22:09       ` Nguyen Thai Ngoc Duy
2010-09-06  4:47   ` [PATCH 3/4] tree-walk: actually move tree_entry_interesting() to tree-walk.c Nguyễn Thái Ngọc Duy
2010-09-06 15:31     ` Elijah Newren
2010-09-06 22:20       ` Nguyen Thai Ngoc Duy
2010-09-06 23:53         ` Junio C Hamano
2010-09-06  4:47   ` [PATCH 4/4] Make rev-list --objects work together with pathspecs Nguyễn Thái Ngọc Duy
2010-09-07  1:28   ` [RFC PATCH 07/15] cache_tree_update(): Capability to handle tree entries missing from index Nguyen Thai Ngoc Duy
2010-09-07  3:06     ` Elijah Newren
2010-09-05  0:14 ` [RFC PATCH 08/15] cache_tree_update(): Require relevant tree to be passed Elijah Newren
2010-09-05  0:14 ` [RFC PATCH 09/15] Add tests for communication dealing with sparse repositories Elijah Newren
2010-09-05  0:14 ` [RFC PATCH 10/15] sparse-repo: Provide a function to record sparse limiting arguments Elijah Newren
2010-09-05  0:14 ` [RFC PATCH 11/15] builtin-clone: Accept paths for sparse clone Elijah Newren
2010-09-05  0:14 ` Elijah Newren [this message]
2010-09-05  0:14 ` [RFC PATCH 13/15] upload-pack: Handle extra rev-list arguments being passed Elijah Newren
2010-09-05  0:14 ` [RFC PATCH 14/15] EVIL COMMIT: Include all commits Elijah Newren
2010-09-05  0:14 ` [RFC PATCH 15/15] clone: Ensure sparse limiting arguments are used in subsequent operations Elijah Newren

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=1283645647-1891-13-git-send-email-newren@gmail.com \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.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.
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).