[PATCH 02/11] builtin/clone: rename "--ref-format=" to "--ref-storage="
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Sep 4, 2026, 10:36 UTC
- Message-ID
- <20260904-b4-pks-unify-ref-storage-format-v1-2-08144e5004ff@pks.im>
- In-Reply-To
- <20260904-b4-pks-unify-ref-storage-format-v1-0-08144e5004ff@pks.im>
With the same reasoning as for git-init(1), rename "--ref-format=" to "--ref-storage=" and keep the old name as an alias.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- Documentation/git-clone.adoc | 2 +- builtin/clone.c | 14 ++++++++------ t/t0610-reftable-basics.sh | 4 ++-- t/t1460-refs-migrate.sh | 2 +- t/t5510-fetch.sh | 6 +++--- t/t5601-clone.sh | 4 ++-- t/t7424-submodule-mixed-ref-formats.sh | 4 ++-- 7 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/Documentation/git-clone.adoc b/Documentation/git-clone.adoc index b6e1f8ada2..57e2bda044 100644 --- a/Documentation/git-clone.adoc +++ b/Documentation/git-clone.adoc @@ -348,7 +348,7 @@ or `--mirror` is given) The result is Git repository can be separated from working tree. -`--ref-format=<ref-format>`:: +`--ref-storage=<ref-format>`:: Specify the given ref storage format for the repository. The valid values are: + diff --git a/builtin/clone.c b/builtin/clone.c index 5b25cca510..63bd7b795d 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -901,7 +901,7 @@ int cmd_clone(int argc, char *option_origin = NULL; struct string_list option_not = STRING_LIST_INIT_NODUP; const char *real_git_dir = NULL; - const char *ref_format = NULL; + const char *ref_storage = NULL; const char *option_upload_pack = "git-upload-pack"; int option_progress = -1; int option_sparse_checkout = 0; @@ -981,8 +981,10 @@ int cmd_clone(int argc, N_("any cloned submodules will be shallow")), OPT_STRING(0, "separate-git-dir", &real_git_dir, N_("gitdir"), N_("separate git dir from working tree")), - OPT_STRING(0, "ref-format", &ref_format, N_("format"), - N_("specify the reference format to use")), + OPT_STRING(0, "ref-storage", &ref_storage, N_("format"), + N_("specify the reference storage format to use")), + OPT_STRING_F(0, "ref-format", &ref_storage, N_("format"), + N_("specify the reference storage format to use"), PARSE_OPT_HIDDEN), OPT_STRING_LIST('c', "config", &option_config, N_("key=value"), N_("set config inside the new repository")), OPT_STRING_LIST(0, "server-option", &server_options, @@ -1027,10 +1029,10 @@ int cmd_clone(int argc, if (option_single_branch == -1) option_single_branch = deepen ? 1 : 0; - if (ref_format) { - ref_storage_format = ref_storage_format_by_name(ref_format); + if (ref_storage) { + ref_storage_format = ref_storage_format_by_name(ref_storage); if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN) - die(_("unknown ref storage format '%s'"), ref_format); + die(_("unknown ref storage format '%s'"), ref_storage); } if (option_mirror) { diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh index 4a83e1ce56..d367b4b787 100755 --- a/t/t0610-reftable-basics.sh +++ b/t/t0610-reftable-basics.sh @@ -165,7 +165,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' ' test_when_finished "rm -rf reffiles reftable" && git init --ref-storage=files reffiles && test_commit -C reffiles A && - git clone --ref-format=reftable ./reffiles reftable && + git clone --ref-storage=reftable ./reffiles reftable && git -C reffiles rev-parse HEAD >expect && git -C reftable rev-parse HEAD >actual && @@ -184,7 +184,7 @@ test_expect_success 'clone: can clone reftable into reffiles repository' ' test_when_finished "rm -rf reffiles reftable" && git init --ref-storage=reftable reftable && test_commit -C reftable A && - git clone --ref-format=files ./reftable reffiles && + git clone --ref-storage=files ./reftable reffiles && git -C reftable rev-parse HEAD >expect && git -C reffiles rev-parse HEAD >actual && diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh index fc04bb7c70..44ad24f16e 100755 --- a/t/t1460-refs-migrate.sh +++ b/t/t1460-refs-migrate.sh @@ -143,7 +143,7 @@ do test_when_finished "rm -rf repo repo.git" && git init --ref-storage=$from_format repo && test_commit -C repo initial && - git clone --ref-format=$from_format --mirror repo repo.git && + git clone --ref-storage=$from_format --mirror repo repo.git && test_migration repo.git "$to_format" ' diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 1b239f4f22..720157e6c5 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -46,19 +46,19 @@ test_expect_success "clone and setup child repos" ' ) && git clone . bundle && git clone . seven && - git clone --ref-format=reftable . case_sensitive && + git clone --ref-storage=reftable . case_sensitive && ( cd case_sensitive && git branch branch1 && git branch bRanch1 ) && - git clone --ref-format=reftable . case_sensitive_fd && + git clone --ref-storage=reftable . case_sensitive_fd && ( cd case_sensitive_fd && git branch foo/bar && git branch Foo ) && - git clone --ref-format=reftable . case_sensitive_df && + git clone --ref-storage=reftable . case_sensitive_df && ( cd case_sensitive_df && git branch Foo/bar && diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index b6167582a1..88f359914f 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -166,7 +166,7 @@ test_expect_success 'clone --mirror does not repeat tags' ' test_expect_success 'clone with files ref format' ' test_when_finished "rm -rf ref-storage" && - git clone --ref-format=files --mirror src ref-storage && + git clone --ref-storage=files --mirror src ref-storage && echo files >expect && git -C ref-storage rev-parse --show-ref-format >actual && test_cmp expect actual @@ -176,7 +176,7 @@ test_expect_success 'clone with garbage ref format' ' cat >expect <<-EOF && fatal: unknown ref storage format ${SQ}garbage${SQ} EOF - test_must_fail git clone --ref-format=garbage --mirror src ref-storage 2>err && + test_must_fail git clone --ref-storage=garbage --mirror src ref-storage 2>err && test_cmp expect err && test_path_is_missing ref-storage ' diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh index d6ea84bb90..1adac7baed 100755 --- a/t/t7424-submodule-mixed-ref-formats.sh +++ b/t/t7424-submodule-mixed-ref-formats.sh @@ -63,9 +63,9 @@ test_expect_success 'recursive clone propagates ref storage format' ' test_ref_format upstream/submodule "$GIT_DEFAULT_REF_FORMAT" && # The cloned repositories should use the other ref format that we have - # specified via `--ref-format`. The option should propagate to cloned + # specified via `--ref-storage`. The option should propagate to cloned # submodules. - git clone --ref-format=$OTHER_FORMAT --recurse-submodules \ + git clone --ref-storage=$OTHER_FORMAT --recurse-submodules \ upstream downstream && test_ref_format downstream "$OTHER_FORMAT" && test_ref_format downstream/submodule "$OTHER_FORMAT"
-- 2.55.0.1007.g17ff1f9808.dirty