git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Turner <dturner@twopensource.com>
To: git@vger.kernel.org, mhagger@alum.mit.edu
Cc: David Turner <dturner@twopensource.com>
Subject: [PATCH v2 18/21] refs: allow ref backend to be set for clone
Date: Mon, 11 Jan 2016 20:22:17 -0500	[thread overview]
Message-ID: <1452561740-8668-19-git-send-email-dturner@twopensource.com> (raw)
In-Reply-To: <1452561740-8668-1-git-send-email-dturner@twopensource.com>

Add a new option, --ref-storage, to allow the ref backend type to
be set on new clones.

Submodules must use the same ref backend as the parent repository, so
we also pass the --ref-storage option option when cloning
submodules.

Signed-off-by: David Turner <dturner@twopensource.com>
---
 Documentation/git-clone.txt |  4 ++++
 builtin/clone.c             |  5 +++++
 builtin/submodule--helper.c |  2 +-
 git-submodule.sh            | 13 +++++++++++++
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 6bf000d..dde2a77 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -14,6 +14,7 @@ SYNOPSIS
 	  [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
 	  [--dissociate] [--separate-git-dir <git dir>]
 	  [--depth <depth>] [--[no-]single-branch]
+	  [--ref-storage=<name>]
 	  [--recursive | --recurse-submodules] [--] <repository>
 	  [<directory>]
 
@@ -221,6 +222,9 @@ objects from the source repository into a pack in the cloned repository.
 	The result is Git repository can be separated from working
 	tree.
 
+--ref-storage=<name>::
+	Type of ref storage backend. Default is to use the original files
+	based ref storage.
 
 <repository>::
 	The (possibly remote) repository to clone from.  See the
diff --git a/builtin/clone.c b/builtin/clone.c
index 53c2834..377e59a 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -92,6 +92,8 @@ static struct option builtin_clone_options[] = {
 		   N_("separate git dir from working tree")),
 	OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
 			N_("set config inside the new repository")),
+	OPT_STRING(0, "ref-storage", &ref_storage_backend,
+		   N_("name"), N_("name of backend type to use")),
 	OPT_END()
 };
 
@@ -726,6 +728,9 @@ static int checkout(void)
 		cmd.git_cmd = 1;
 		argv_array_pushl(&cmd.args, "submodule", "update",
 				 "--init", "--recursive", NULL);
+		argv_array_pushl(&cmd.args, "--ref-storage",
+				 ref_storage_backend, NULL);
+
 		err = run_command(&cmd);
 	}
 
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index f4c3eff..a411332 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -140,7 +140,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
 		argv_array_pushl(&cp.args, "--reference", reference, NULL);
 	if (gitdir && *gitdir)
 		argv_array_pushl(&cp.args, "--separate-git-dir", gitdir, NULL);
-
+	argv_array_pushl(&cp.args, "--ref-storage", ref_storage_backend, NULL);
 	argv_array_push(&cp.args, url);
 	argv_array_push(&cp.args, path);
 
diff --git a/git-submodule.sh b/git-submodule.sh
index 9bc5c5f..d8a9192 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -637,6 +637,14 @@ cmd_update()
 		--checkout)
 			update="checkout"
 			;;
+		--ref-storage=*)
+			ref_storage="$1"
+			;;
+		--ref-storage)
+			case "$2" in '') usage ;; esac
+			ref_storage="$2"
+			shift
+			;;
 		--depth)
 			case "$2" in '') usage ;; esac
 			depth="--depth=$2"
@@ -662,6 +670,11 @@ cmd_update()
 	if test -n "$init"
 	then
 		cmd_init "--" "$@" || return
+	else
+		if test -n "$ref_storage"
+		then
+			usage
+		fi
 	fi
 
 	cloned_modules=
-- 
2.4.2.749.g730654d-twtrsrc

  parent reply	other threads:[~2016-01-12  1:23 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12  1:21 [PATCH v2 00/21] refs backend reroll David Turner
2016-01-12  1:22 ` [PATCH v2 01/21] refs: add a backend method structure with transaction functions David Turner
2016-01-12  1:22 ` [PATCH v2 02/21] refs: add methods for misc ref operations David Turner
2016-01-12  1:22 ` [PATCH v2 03/21] refs: add methods for the ref iterators David Turner
2016-01-12  1:22 ` [PATCH v2 04/21] refs: add do_for_each_per_worktree_ref David Turner
2016-01-12  1:22 ` [PATCH v2 05/21] refs: add methods for reflog David Turner
2016-01-12  1:22 ` [PATCH v2 06/21] refs: add method for initial ref transaction commit David Turner
2016-01-12  1:22 ` [PATCH v2 07/21] refs: add method for delete_refs David Turner
2016-01-12  1:22 ` [PATCH v2 08/21] refs: add methods to init refs db David Turner
2016-01-12  1:22 ` [PATCH v2 09/21] refs: add method to rename refs David Turner
2016-01-12  1:22 ` [PATCH v2 10/21] refs: make lock generic David Turner
2016-01-12  1:22 ` [PATCH v2 11/21] refs: move duplicate check to common code David Turner
2016-01-12  1:22 ` [PATCH v2 12/21] refs: allow log-only updates David Turner
2016-01-12  1:22 ` [PATCH v2 13/21] refs: resolve symbolic refs first David Turner
2016-01-13  0:19   ` Junio C Hamano
2016-01-13 16:33     ` David Turner
2016-01-12  1:22 ` [PATCH v2 14/21] refs: always handle non-normal refs in files backend David Turner
2016-01-13  0:19   ` Junio C Hamano
2016-01-13 16:34     ` David Turner
2016-01-12  1:22 ` [PATCH v2 15/21] init: allow alternate backends to be set for new repos David Turner
2016-01-12  1:22 ` [PATCH v2 16/21] refs: check submodules ref storage config David Turner
2016-01-13  0:19   ` Junio C Hamano
2016-01-13 16:32     ` David Turner
2016-01-13 17:02       ` Junio C Hamano
2016-01-12  1:22 ` [PATCH v2 17/21] clone: use child_process for recursive checkouts David Turner
2016-01-12  1:22 ` David Turner [this message]
2016-01-12  1:22 ` [PATCH v2 19/21] svn: learn ref-storage argument David Turner
2016-01-12  1:22 ` [PATCH v2 20/21] refs: add LMDB refs backend David Turner
2016-01-14 20:52   ` Jeff King
2016-01-14 22:30     ` David Turner
2016-01-12  1:22 ` [PATCH v2 21/21] refs: tests for lmdb backend David Turner
2016-01-13  0:22 ` [PATCH v2 00/21] refs backend reroll Junio C Hamano
2016-01-14  9:26   ` Jeff King
2016-01-14 16:25     ` David Turner
2016-01-14 20:12       ` Jeff King

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=1452561740-8668-19-git-send-email-dturner@twopensource.com \
    --to=dturner@twopensource.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /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).