diff --git a/Documentation/config/init.adoc b/Documentation/config/init.adoc index 7b4abdaf8b..a048f0bddc 100644 --- a/Documentation/config/init.adoc +++ b/Documentation/config/init.adoc @@ -15,7 +15,7 @@ endif::[] this config. `init.defaultRefFormat`:: Allows overriding the default ref storage format for new repositories. - See `--ref-format=` in linkgit:git-init[1]. Both the command line + See `--ref-storage-format=` in linkgit:git-init[1]. Both the command line option and the `GIT_DEFAULT_REF_FORMAT` environment variable take precedence over this config. diff --git a/Documentation/git-init.adoc b/Documentation/git-init.adoc index bab99b9b47..73e1f787cb 100644 --- a/Documentation/git-init.adoc +++ b/Documentation/git-init.adoc @@ -11,7 +11,7 @@ SYNOPSIS [synopsis] git init [-q | --quiet] [--bare] [--template=] [--separate-git-dir ] [--object-format=] - [--ref-format=] + [--ref-storage-format=] [-b | --initial-branch=] [--shared[=]] [] @@ -57,11 +57,14 @@ values are `sha1` and (if enabled) `sha256`. `sha1` is the default. + include::object-format-disclaimer.adoc[] -`--ref-format=`:: +`--ref-storage-format=`:: Specify the given ref storage __ for the repository. The valid values are: + include::ref-storage-format.adoc[] +`--ref-format=`:: +Deprecated alias of `--ref-storage-format=`. + `--template=`:: Specify the directory from which templates will be used. (See the "TEMPLATE DIRECTORY" section below.) diff --git a/Documentation/git.adoc b/Documentation/git.adoc index 8a5cdd3b3d..23ba65656e 100644 --- a/Documentation/git.adoc +++ b/Documentation/git.adoc @@ -593,7 +593,7 @@ double-quotes and respecting backslash escapes. E.g., the value `GIT_DEFAULT_REF_FORMAT`:: If this variable is set, the default reference backend format for new repositories will be set to this value. The default is "files". - See `--ref-format` in linkgit:git-init[1]. + See `--ref-storage-format` in linkgit:git-init[1]. `GIT_REFERENCE_BACKEND`:: Specify which reference backend to be used along with its URI. diff --git a/builtin/init-db.c b/builtin/init-db.c index e96b1283b7..1612413af0 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -57,7 +57,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset) static const char *const init_db_usage[] = { N_("git init [-q | --quiet] [--bare] [--template=]\n" " [--separate-git-dir ] [--object-format=]\n" - " [--ref-format=]\n" + " [--ref-storage-format=]\n" " [-b | --initial-branch=]\n" " [--shared[=]] []"), NULL @@ -83,7 +83,7 @@ int cmd_init_db(int argc, unsigned int flags = 0; int bare = startup_info->force_bare_repository ? 1 : -1; const char *object_format = NULL; - const char *ref_format = NULL; + const char *ref_storage_format_str = NULL; const char *initial_branch = NULL; int hash_algo = GIT_HASH_UNKNOWN; enum ref_storage_format ref_storage_format = REF_STORAGE_FORMAT_UNKNOWN; @@ -109,8 +109,9 @@ int cmd_init_db(int argc, N_("override the name of the initial branch")), OPT_STRING(0, "object-format", &object_format, N_("hash"), N_("specify the hash algorithm to use")), - 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_END() }; int ret; @@ -173,10 +174,10 @@ int cmd_init_db(int argc, die(_("unknown hash algorithm '%s'"), object_format); } - 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 (init_shared_repository != -1) diff --git a/t/perf/p1401-ref-store-tombstones.sh b/t/perf/p1401-ref-store-tombstones.sh index 9e3d8031aa..37ffe0c3a7 100755 --- a/t/perf/p1401-ref-store-tombstones.sh +++ b/t/perf/p1401-ref-store-tombstones.sh @@ -5,7 +5,7 @@ test_description="Tests performance of ref operations with many tombstones" . ./perf-lib.sh test_expect_success "setup" ' - git init --ref-format=reftable repo && + git init --ref-storage-format=reftable repo && blob=$(echo foo | git -C repo hash-object -w --stdin) && for i in $(test_seq 8000) do @@ -24,7 +24,7 @@ test_perf "recreate refs after mass delete" ' ' test_expect_success "setup asymmetric" ' - git init --ref-format=reftable repo2 && + git init --ref-storage-format=reftable repo2 && blob=$(echo foo | git -C repo2 hash-object -w --stdin) && for i in $(test_seq 8000) do diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh index 2ac007888e..3ce49fd423 100644 --- a/t/perf/perf-lib.sh +++ b/t/perf/perf-lib.sh @@ -153,7 +153,7 @@ test_perf_create_repo_from () { ) && ( cd "$repo" && - "$MODERN_GIT" init -q --ref-format="$refformat" --object-format="$objectformat" && + "$MODERN_GIT" init -q --ref-storage-format="$refformat" --object-format="$objectformat" && test_perf_do_repo_symlink_config_ && mv .git/hooks .git/hooks-disabled 2>/dev/null && if test -f .git/index.lock diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 5cf2e5a35a..df9a2ff2da 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -696,9 +696,9 @@ do test_cmp expect actual ' - test_expect_success "init with --ref-format=$format" ' + test_expect_success "init with --ref-storage-format=$format" ' test_when_finished "rm -rf refformat" && - git init --ref-format=$format refformat && + git init --ref-storage-format=$format refformat && echo $format >expect && git -C refformat rev-parse --show-ref-format >actual && test_cmp expect actual @@ -717,9 +717,9 @@ do test_cmp expect actual ' - test_expect_success "--ref-format=$format overrides GIT_DEFAULT_REF_FORMAT" ' + test_expect_success "--ref-storage-format=$format overrides GIT_DEFAULT_REF_FORMAT" ' test_when_finished "rm -rf refformat" && - GIT_DEFAULT_REF_FORMAT=garbage git init --ref-format=$format refformat && + GIT_DEFAULT_REF_FORMAT=garbage git init --ref-storage-format=$format refformat && echo $format >expect && git -C refformat rev-parse --show-ref-format >actual && test_cmp expect actual @@ -735,9 +735,9 @@ do ' done -test_expect_success "--ref-format= overrides GIT_DEFAULT_REF_FORMAT" ' +test_expect_success "--ref-storage-format= overrides GIT_DEFAULT_REF_FORMAT" ' test_when_finished "rm -rf refformat" && - GIT_DEFAULT_REF_FORMAT=files git init --ref-format=reftable refformat && + GIT_DEFAULT_REF_FORMAT=files git init --ref-storage-format=reftable refformat && echo reftable >expect && git -C refformat rev-parse --show-ref-format >actual && test_cmp expect actual @@ -791,8 +791,8 @@ for from_format in $backends do test_expect_success "re-init with same format ($from_format)" ' test_when_finished "rm -rf refformat" && - git init --ref-format=$from_format refformat && - git init --ref-format=$from_format refformat && + git init --ref-storage-format=$from_format refformat && + git init --ref-storage-format=$from_format refformat && echo $from_format >expect && git -C refformat rev-parse --show-ref-format >actual && test_cmp expect actual @@ -807,11 +807,11 @@ do test_expect_success "re-init with different format fails ($from_format -> $to_format)" ' test_when_finished "rm -rf refformat" && - git init --ref-format=$from_format refformat && + git init --ref-storage-format=$from_format refformat && cat >expect <<-EOF && fatal: attempt to reinitialize repository with different reference storage format EOF - test_must_fail git init --ref-format=$to_format refformat 2>err && + test_must_fail git init --ref-storage-format=$to_format refformat 2>err && test_cmp expect err && echo $from_format >expect && git -C refformat rev-parse --show-ref-format >actual && @@ -820,12 +820,12 @@ do done done -test_expect_success 'init with --ref-format=garbage' ' +test_expect_success 'init with --ref-storage-format=garbage' ' test_when_finished "rm -rf refformat" && cat >expect <<-EOF && fatal: unknown ref storage format ${SQ}garbage${SQ} EOF - test_must_fail git init --ref-format=garbage refformat 2>err && + test_must_fail git init --ref-storage-format=garbage refformat 2>err && test_cmp expect err ' diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh index 35e98b43db..1cf96ce2c5 100755 --- a/t/t0610-reftable-basics.sh +++ b/t/t0610-reftable-basics.sh @@ -59,28 +59,28 @@ test_expect_success 'init: reinitializing reftable backend succeeds' ' test_commit -C repo A && git -C repo for-each-ref >expect && - git init --ref-format=reftable repo && + git init --ref-storage-format=reftable repo && git -C repo for-each-ref >actual && test_cmp expect actual ' test_expect_success 'init: reinitializing files with reftable backend fails' ' test_when_finished "rm -rf repo" && - git init --ref-format=files repo && + git init --ref-storage-format=files repo && test_commit -C repo file && cp repo/.git/HEAD expect && - test_must_fail git init --ref-format=reftable repo && + test_must_fail git init --ref-storage-format=reftable repo && test_cmp expect repo/.git/HEAD ' test_expect_success 'init: reinitializing reftable with files backend fails' ' test_when_finished "rm -rf repo" && - git init --ref-format=reftable repo && + git init --ref-storage-format=reftable repo && test_commit -C repo file && cp repo/.git/HEAD expect && - test_must_fail git init --ref-format=files repo && + test_must_fail git init --ref-storage-format=files repo && test_cmp expect repo/.git/HEAD ' @@ -163,7 +163,7 @@ test_expect_success 'clone: can clone reftable repository' ' test_expect_success 'clone: can clone reffiles into reftable repository' ' test_when_finished "rm -rf reffiles reftable" && - git init --ref-format=files reffiles && + git init --ref-storage-format=files reffiles && test_commit -C reffiles A && git clone --ref-format=reftable ./reffiles reftable && @@ -182,7 +182,7 @@ test_expect_success 'clone: can clone reffiles into reftable repository' ' test_expect_success 'clone: can clone reftable into reffiles repository' ' test_when_finished "rm -rf reffiles reftable" && - git init --ref-format=reftable reftable && + git init --ref-storage-format=reftable reftable && test_commit -C reftable A && git clone --ref-format=files ./reftable reffiles && diff --git a/t/t0611-reftable-httpd.sh b/t/t0611-reftable-httpd.sh index 5e05b9c1f2..b030814b9f 100755 --- a/t/t0611-reftable-httpd.sh +++ b/t/t0611-reftable-httpd.sh @@ -10,7 +10,7 @@ start_httpd REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo" test_expect_success 'serving ls-remote' ' - git init --ref-format=reftable -b main "$REPO" && + git init --ref-storage-format=reftable -b main "$REPO" && cd "$REPO" && test_commit m1 && >.git/git-daemon-export-ok && diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 269fdaa3ed..1a164c96f9 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -2361,7 +2361,7 @@ do ' test_expect_success CASE_INSENSITIVE_FS "stdin $type batch-updates existing reference" ' - git init --ref-format=reftable repo && + git init --ref-storage-format=reftable repo && test_when_finished "rm -fr repo" && ( cd repo && diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh index fd47d77e8e..9ae295cf3d 100755 --- a/t/t1423-ref-backend.sh +++ b/t/t1423-ref-backend.sh @@ -137,7 +137,7 @@ do test_expect_success "$method: read from $to_format backend, $dir dir" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && ( cd repo && test_commit 1 && @@ -152,7 +152,7 @@ do test_expect_success "$method: write to $to_format backend, $dir dir" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && ( cd repo && test_commit 1 && @@ -179,7 +179,7 @@ do test_expect_success "$method: with worktree and $to_format backend, $dir dir" ' test_when_finished "rm -rf repo wt" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && ( cd repo && test_commit 1 && diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh index 8f42697143..bb2507f571 100755 --- a/t/t1460-refs-migrate.sh +++ b/t/t1460-refs-migrate.sh @@ -105,7 +105,7 @@ do test_expect_success "$from_format: migration to same format fails" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_must_fail git -C repo refs migrate \ --ref-format=$from_format 2>err && cat >expect <<-EOF && @@ -116,7 +116,7 @@ do test_expect_success "$from_format -> $to_format: migration with worktree fails" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && git -C repo worktree add wt && test_must_fail git -C repo refs migrate \ --ref-format=$to_format 2>err && @@ -128,20 +128,20 @@ do test_expect_success "$from_format -> $to_format: unborn HEAD" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_migration repo "$to_format" ' test_expect_success "$from_format -> $to_format: single ref" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && test_migration repo "$to_format" ' test_expect_success "$from_format -> $to_format: bare repository" ' test_when_finished "rm -rf repo repo.git" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && git clone --ref-format=$from_format --mirror repo repo.git && test_migration repo.git "$to_format" @@ -149,7 +149,7 @@ do test_expect_success "$from_format -> $to_format: dangling symref" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && git -C repo symbolic-ref BROKEN_HEAD refs/heads/nonexistent && test_migration repo "$to_format" && @@ -160,7 +160,7 @@ do test_expect_success "$from_format -> $to_format: broken ref" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && test-tool -C repo ref-store main update-ref "" refs/heads/broken \ "$(test_oid 001)" "$ZERO_OID" REF_SKIP_CREATE_REFLOG,REF_SKIP_OID_VERIFICATION && @@ -172,7 +172,7 @@ do test_expect_success "$from_format -> $to_format: pseudo-refs" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && git -C repo update-ref FOO_HEAD HEAD && test_migration repo "$to_format" @@ -180,7 +180,7 @@ do test_expect_success "$from_format -> $to_format: special refs are left alone" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && git -C repo rev-parse HEAD >repo/.git/MERGE_HEAD && git -C repo rev-parse MERGE_HEAD && @@ -190,7 +190,7 @@ do test_expect_success "$from_format -> $to_format: a bunch of refs" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && cat >input <<-EOF && @@ -208,7 +208,7 @@ do test_expect_success "$from_format -> $to_format: dry-run migration does not modify repository" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && git -C repo refs migrate --dry-run \ --ref-format=$to_format >output && @@ -221,7 +221,7 @@ do test_expect_success "$from_format -> $to_format: reflogs of symrefs with target deleted" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && git -C repo branch branch-1 HEAD && git -C repo symbolic-ref refs/heads/symref refs/heads/branch-1 && @@ -234,7 +234,7 @@ do test_expect_success "$from_format -> $to_format: reflogs order is retained" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit --date "100005000 +0700" --no-tag -C repo initial && test_commit --date "100003000 +0700" --no-tag -C repo second && test_migration repo "$to_format" @@ -242,7 +242,7 @@ do test_expect_success "$from_format -> $to_format: stash is retained" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && ( cd repo && test_commit initial A && @@ -259,7 +259,7 @@ do test_expect_success "$from_format -> $to_format: skip reflog with --skip-reflog" ' test_when_finished "rm -rf repo" && - git init --ref-format=$from_format repo && + git init --ref-storage-format=$from_format repo && test_commit -C repo initial && # we see that the repository contains reflogs. git -C repo reflog --all >reflogs && @@ -274,7 +274,7 @@ done test_expect_success 'multiple reftable blocks with multiple entries' ' test_when_finished "rm -rf repo" && - git init --ref-format=files repo && + git init --ref-storage-format=files repo && test_commit -C repo first && test_seq -f "create refs/heads/ref-%d HEAD" 5000 | git -C repo update-ref --stdin && @@ -286,7 +286,7 @@ test_expect_success 'multiple reftable blocks with multiple entries' ' test_expect_success 'migrating from files format deletes backend files' ' test_when_finished "rm -rf repo" && - git init --ref-format=files repo && + git init --ref-storage-format=files repo && test_commit -C repo first && git -C repo pack-refs --all && test_commit -C repo second && @@ -313,7 +313,7 @@ test_expect_success 'migrating from files format deletes backend files' ' test_expect_success 'migrating from reftable format deletes backend files' ' test_when_finished "rm -rf repo" && - git init --ref-format=reftable repo && + git init --ref-storage-format=reftable repo && test_commit -C repo first && test_path_is_dir repo/.git/reftable && diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh index c85d390f43..d115d2d9f9 100755 --- a/t/t1900-repo-info.sh +++ b/t/t1900-repo-info.sh @@ -39,10 +39,10 @@ test_repo_info () { } test_repo_info 'ref format files is retrieved correctly' \ - 'git init --ref-format=files' 'format-files' 'references.format' 'files' + 'git init --ref-storage-format=files' 'format-files' 'references.format' 'files' test_repo_info 'ref format reftable is retrieved correctly' \ - 'git init --ref-format=reftable' 'format-reftable' 'references.format' 'reftable' + 'git init --ref-storage-format=reftable' 'format-reftable' 'references.format' 'reftable' test_repo_info 'bare repository = false is retrieved correctly' \ 'git init' 'nonbare' 'layout.bare' 'false' @@ -75,7 +75,7 @@ test_expect_success 'values returned in order requested' ' references.format=files layout.bare=false EOF - git init --ref-format=files ordered && + git init --ref-storage-format=files ordered && git -C ordered repo info layout.bare references.format layout.bare >actual && test_cmp expect actual ' diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index a8d38d9176..359c3cf99b 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -1803,7 +1803,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'existing references in a case test_expect_success REFFILES 'existing reference lock in repo' ' test_when_finished rm -rf base repo && ( - git init --ref-format=reftable base && + git init --ref-storage-format=reftable base && cd base && echo >file update && git add . && @@ -1814,7 +1814,7 @@ test_expect_success REFFILES 'existing reference lock in repo' ' git update-ref refs/heads/branch @ && cd .. && - git init --ref-format=files --bare repo && + git init --ref-storage-format=files --bare repo && cd repo && git remote add origin ../base && touch refs/heads/foo.lock && @@ -1857,7 +1857,7 @@ test_expect_success CASE_INSENSITIVE_FS,REFFILES 'D/F conflict on case insensiti test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with lock' ' test_when_finished rm -rf base repo && ( - git init --ref-format=reftable base && + git init --ref-storage-format=reftable base && cd base && echo >file update && git add . && @@ -1868,7 +1868,7 @@ test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with loc git update-ref refs/heads/branch @ && cd .. && - git init --ref-format=files --bare repo && + git init --ref-storage-format=files --bare repo && cd repo && git remote add origin ../base && mkdir refs/heads/foo && diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh index 559713b607..1ca245c732 100755 --- a/t/t7424-submodule-mixed-ref-formats.sh +++ b/t/t7424-submodule-mixed-ref-formats.sh @@ -31,7 +31,7 @@ test_expect_success 'add existing repository with different ref storage format' ( cd parent && test_commit parent && - git init --ref-format=$OTHER_FORMAT submodule && + git init --ref-storage-format=$OTHER_FORMAT submodule && test_commit -C submodule submodule && git submodule add ./submodule )