From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Turner Subject: [PATCH v5 22/27] clone: allow ref storage backend to be set for clone Date: Thu, 18 Feb 2016 00:17:45 -0500 Message-ID: <1455772670-21142-23-git-send-email-dturner@twopensource.com> References: <1455772670-21142-1-git-send-email-dturner@twopensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: David Turner , =?UTF-8?q?SZEDER=20G=C3=A1bor?= To: git@vger.kernel.org, mhagger@alum.mit.edu X-From: git-owner@vger.kernel.org Thu Feb 18 06:19:50 2016 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 1aWH0H-00022q-GJ for gcvg-git-2@plane.gmane.org; Thu, 18 Feb 2016 06:19:49 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425007AbcBRFTp convert rfc822-to-quoted-printable (ORCPT ); Thu, 18 Feb 2016 00:19:45 -0500 Received: from mail-qg0-f42.google.com ([209.85.192.42]:35261 "EHLO mail-qg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424939AbcBRFS7 (ORCPT ); Thu, 18 Feb 2016 00:18:59 -0500 Received: by mail-qg0-f42.google.com with SMTP id y89so29373157qge.2 for ; Wed, 17 Feb 2016 21:18:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=twopensource-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=oAktknKjkoD5upHnMA+otfnMWi1B0WOwYunrTbs4Tv0=; b=2P9OSkc1u0TqUlEOYSNR6I5Tl+1V2JwopsV3hGmgGYjId+NqUJJOAGPZgAi/C+BXdn SQoq4fJ+Z566o6eRpgknQ5u4EtjtNBHaatiwrsB1OsdfHlroOmTIt1laFmyAUSe4Kr2f oUX7dehjuonfxi9GfyrxqfXtA2MPuY7niud2B7IXgRvtnhg2EjGWXCL1NDhIPzSk8fc8 6jaaZev5USr2ZGTlmfYf+t/coaTjBBz6RQSy0vP9SywD0bCrsZYcF7UGR+NiAP/n4DwB 6E9JdpMBCqeZqwXj8WagTkN4szlThG9YFU4abFw4POHo9jT5CwpoxfxrQyA9+1ebwF2U 6hRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=oAktknKjkoD5upHnMA+otfnMWi1B0WOwYunrTbs4Tv0=; b=hZHsh1i5YDY3gMkKOVfS07XZg2aSwx2m7C42BuY0ny4nLpMSLXIUqa4TMIRJR3CR65 1yDp/HxrHffRAOqcunlqNoHpHIWj76pO+9cmHuccNjVu7ZFcwRJg1y9la9Rgiiwm2Bxd QJQAqgIvPe+HnQEPG7OxnRaOZgXz/juj9yIsLfKB7qM4+B95ZEqQu2DQdE3Jhw+0P5Js SlDestLuB3v+Z02ahh66jsgaYYj3YMKH2xd8WOSL/YtM4KPHURXPx5zmnpI93NCMztE2 TF/u+rjZRkEYJRNf0vq4f3quyzFJGKv4ycx/FbtaGBLAJKmii2sukdMtOujM3EPTsiIU CTUw== X-Gm-Message-State: AG10YOQNKh3dNBqFjPsvVr4f0On0Qlq/cD8zOsbH6oomqmBipwNyTL467EdEQE5jbesCeQ== X-Received: by 10.140.18.136 with SMTP id 8mr6638441qgf.64.1455772738108; Wed, 17 Feb 2016 21:18:58 -0800 (PST) Received: from ubuntu.twitter.corp? ([8.25.196.26]) by smtp.gmail.com with ESMTPSA id q22sm1965322qkl.19.2016.02.17.21.18.56 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Feb 2016 21:18:57 -0800 (PST) X-Mailer: git-send-email 2.4.2.767.g62658d5-twtrsrc In-Reply-To: <1455772670-21142-1-git-send-email-dturner@twopensource.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Add a new option, --ref-storage, to allow the ref storage backend to be set on new clones. Submodules must use the same ref storage as the parent repository, so we also pass the --ref-storage option option when cloning submodules. Signed-off-by: David Turner Signed-off-by: SZEDER G=C3=A1bor --- Documentation/git-clone.txt | 5 +++++ builtin/clone.c | 5 +++++ builtin/submodule--helper.c | 2 +- contrib/completion/git-completion.bash | 1 + git-submodule.sh | 13 +++++++++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt index 45d74be..68f56a7 100644 --- a/Documentation/git-clone.txt +++ b/Documentation/git-clone.txt @@ -14,6 +14,7 @@ SYNOPSIS [-o ] [-b ] [-u ] [--reference ] [--dissociate] [--separate-git-dir ] [--depth ] [--[no-]single-branch] + [--ref-storage=3D] [--recursive | --recurse-submodules] [--jobs ] [--] [] =20 @@ -224,6 +225,10 @@ objects from the source repository into a pack in = the cloned repository. The number of submodules fetched at the same time. Defaults to the `submodule.fetchJobs` option. =20 +--ref-storage=3D:: + Type of ref storage backend. Default is to use the original files + based ref storage. + :: The (possibly remote) repository to clone from. See the <> section below for more information on specifying diff --git a/builtin/clone.c b/builtin/clone.c index 191f522..5ba0514 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -95,6 +95,8 @@ static struct option builtin_clone_options[] =3D { N_("separate git dir from working tree")), OPT_STRING_LIST('c', "config", &option_config, N_("key=3Dvalue"), 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() }; =20 @@ -733,6 +735,9 @@ static int checkout(void) if (max_jobs !=3D -1) argv_array_pushf(&args, "--jobs=3D%d", max_jobs); =20 + argv_array_pushl(&args, "--ref-storage", + ref_storage_backend, NULL); + err =3D run_command_v_opt(args.argv, RUN_GIT_CMD); argv_array_clear(&args); } diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 689c354..879d6fb 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -457,7 +457,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); =20 diff --git a/contrib/completion/git-completion.bash b/contrib/completio= n/git-completion.bash index 0138d03..cb9c473 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1092,6 +1092,7 @@ _git_clone () --depth --single-branch --branch + --ref-storage=3D " return ;; diff --git a/git-submodule.sh b/git-submodule.sh index 6fce0dc..e7ac98b 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -527,6 +527,14 @@ cmd_update() --checkout) update=3D"checkout" ;; + --ref-storage=3D*) + ref_storage=3D"$1" + ;; + --ref-storage) + case "$2" in '') usage ;; esac + ref_storage=3D"$2" + shift + ;; --depth) case "$2" in '') usage ;; esac depth=3D"--depth=3D$2" @@ -560,6 +568,11 @@ cmd_update() if test -n "$init" then cmd_init "--" "$@" || return + else + if test -n "$ref_storage" + then + usage + fi fi =20 git submodule--helper update-clone ${GIT_QUIET:+--quiet} \ --=20 2.4.2.767.g62658d5-twtrsrc