diff --git a/Documentation/git-clone.adoc b/Documentation/git-clone.adoc index b6e1f8ada2..27e4d13942 100644 --- a/Documentation/git-clone.adoc +++ b/Documentation/git-clone.adoc @@ -348,12 +348,15 @@ or `--mirror` is given) The result is Git repository can be separated from working tree. -`--ref-format=`:: +`--ref-storage-format=`:: Specify the given ref storage format for the repository. The valid values are: + include::ref-storage-format.adoc[] +`--ref-format=`:: +Deprecated alias of `--ref-storage-format=`. + `-j`:: `--jobs=`:: The number of submodules fetched at the same time. diff --git a/builtin/clone.c b/builtin/clone.c index 5b25cca510..42cae9e0f6 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_format_str = NULL; const char *option_upload_pack = "git-upload-pack"; int option_progress = -1; int option_sparse_checkout = 0; @@ -981,8 +981,9 @@ 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-format", &ref_storage_format_str, N_("format"), + N_("specify the reference storage format to use")), + OPT_ALIAS_F(0, "ref-format", "ref-storage-format", 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 +1028,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_format_str) { + ref_storage_format = ref_storage_format_by_name(ref_storage_format_str); if (ref_storage_format == REF_STORAGE_FORMAT_UNKNOWN) - die(_("unknown ref storage format '%s'"), ref_format); + die(_("unknown ref storage format '%s'"), ref_storage_format_str); } if (option_mirror) { diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh index 1cf96ce2c5..d325f17a14 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-format=files reffiles && test_commit -C reffiles A && - git clone --ref-format=reftable ./reffiles reftable && + git clone --ref-storage-format=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-format=reftable reftable && test_commit -C reftable A && - git clone --ref-format=files ./reftable reffiles && + git clone --ref-storage-format=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 bb2507f571..8aded6597e 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-format=$from_format repo && test_commit -C repo initial && - git clone --ref-format=$from_format --mirror repo repo.git && + git clone --ref-storage-format=$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 359c3cf99b..300bd5396d 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-format=reftable . case_sensitive && ( cd case_sensitive && git branch branch1 && git branch bRanch1 ) && - git clone --ref-format=reftable . case_sensitive_fd && + git clone --ref-storage-format=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-format=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..202d86bc83 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-format=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-format=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 1ca245c732..5f31d233e9 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-format`. The option should propagate to cloned # submodules. - git clone --ref-format=$OTHER_FORMAT --recurse-submodules \ + git clone --ref-storage-format=$OTHER_FORMAT --recurse-submodules \ upstream downstream && test_ref_format downstream "$OTHER_FORMAT" && test_ref_format downstream/submodule "$OTHER_FORMAT"