From: Patrick Steinhardt Date: Mon, 01 Jun 2026 07:56:00 GMT Subject: [PATCH 2/2] builtin/init-db: deprecate alias for git-init(1) Message-ID: <20260601-pks-deprecate-git-init-db-v1-2-ea3e6eebe674@pks.im> In-Reply-To: <20260601-pks-deprecate-git-init-db-v1-0-ea3e6eebe674@pks.im> The git-init-db(1) command was initially only initializing the object database of a Git repository. This has changed over time so that the command also initializes all the other data structures, which is why we have eventually introduced git-init(1) as a more aptly named replacement for it. This has all happened in 2007 already, and with 5c94f87e6b (use 'init' instead of 'init-db' for shipped docs and tools, 2007-01-12) we have also adapted all user-facing documentation to mention the replacement. It is thus safe to assume that (almost) nobody uses git-init-db(1) nowadays anymore. Deprecate the command in favor of git-init(1) and wire up the removal when compiling Git with breaking changes enabled. Signed-off-by: Patrick Steinhardt --- Documentation/BreakingChanges.adoc | 3 +++ Documentation/Makefile | 1 + Documentation/git-init-db.adoc | 5 +++++ Documentation/meson.build | 2 +- Makefile | 2 +- git.c | 2 ++ t/t5502-quickfetch.sh | 4 ++-- t/t5503-tagfollow.sh | 2 +- 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc index 73bb939359..89b7482f54 100644 --- a/Documentation/BreakingChanges.adoc +++ b/Documentation/BreakingChanges.adoc @@ -300,6 +300,9 @@ references. + These features will be removed. +* The git-init-db(1) command is an alias for its modern drop-in replacement + git-init(1). The alias will be removed. + * Support for "--stdin" option in the "name-rev" command was deprecated (and hidden from the documentation) in the Git 2.40 timeframe, in preference to its synonym "--annotate-stdin". Git 3.0 diff --git a/Documentation/Makefile b/Documentation/Makefile index 2699f0b24a..3769856b58 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -541,6 +541,7 @@ lint-docs-meson: sort >tmp-meson-diff/meson.adoc && \ ls git*.adoc scalar.adoc | \ grep -v -e git-bisect-lk2009.adoc \ + -e git-init-db.adoc \ -e git-pack-redundant.adoc \ -e git-tools.adoc \ -e git-whatchanged.adoc \ diff --git a/Documentation/git-init-db.adoc b/Documentation/git-init-db.adoc index 18bf1a3c8c..9802fc9f3d 100644 --- a/Documentation/git-init-db.adoc +++ b/Documentation/git-init-db.adoc @@ -11,6 +11,11 @@ SYNOPSIS [verse] 'git init-db' [-q | --quiet] [--bare] [--template=] [--separate-git-dir ] [--shared[=]] +WARNING +------- + +`git init-db` has been deprecated in favor of `git init`, which is a drop-in +replacement for `git init-db`. DESCRIPTION ----------- diff --git a/Documentation/meson.build b/Documentation/meson.build index f4854f802d..0f127d752d 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -72,7 +72,6 @@ manpages = { 'git-http-push.adoc' : 1, 'git-imap-send.adoc' : 1, 'git-index-pack.adoc' : 1, - 'git-init-db.adoc' : 1, 'git-init.adoc' : 1, 'git-instaweb.adoc' : 1, 'git-interpret-trailers.adoc' : 1, @@ -212,6 +211,7 @@ manpages = { } manpages_breaking_changes = { + 'git-init-db.adoc' : 1, 'git-pack-redundant.adoc' : 1, 'git-whatchanged.adoc' : 1, } diff --git a/Makefile b/Makefile index b03f74ee8c..4420231753 100644 --- a/Makefile +++ b/Makefile @@ -894,7 +894,6 @@ BUILT_INS += git-cherry-pick$X BUILT_INS += git-format-patch$X BUILT_INS += git-format-rev$X BUILT_INS += git-fsck-objects$X -BUILT_INS += git-init-db$X BUILT_INS += git-maintenance$X BUILT_INS += git-merge-subtree$X BUILT_INS += git-restore$X @@ -904,6 +903,7 @@ BUILT_INS += git-status$X BUILT_INS += git-switch$X BUILT_INS += git-version$X ifndef WITH_BREAKING_CHANGES +BUILT_INS += git-init-db$X BUILT_INS += git-whatchanged$X endif diff --git a/git.c b/git.c index a72394b599..6bf6a60360 100644 --- a/git.c +++ b/git.c @@ -591,7 +591,9 @@ static struct cmd_struct commands[] = { { "hook", cmd_hook, RUN_SETUP_GENTLY }, { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY | NO_PARSEOPT }, { "init", cmd_init }, +#ifndef WITH_BREAKING_CHANGES { "init-db", cmd_init }, +#endif { "interpret-trailers", cmd_interpret_trailers, RUN_SETUP_GENTLY }, { "last-modified", cmd_last_modified, RUN_SETUP }, { "log", cmd_log, RUN_SETUP }, diff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh index b160f8b7fb..a2b62f551a 100755 --- a/t/t5502-quickfetch.sh +++ b/t/t5502-quickfetch.sh @@ -25,7 +25,7 @@ test_expect_success 'clone without alternate' ' ( mkdir cloned && cd cloned && - git init-db && + git init && git remote add -f origin .. ) && cnt=$( ( @@ -94,7 +94,7 @@ test_expect_success 'quickfetch should not copy from alternate' ' ( mkdir quickclone && cd quickclone && - git init-db && + git init && (cd ../.git/objects && pwd) >.git/objects/info/alternates && git remote add origin .. && git fetch -k -k diff --git a/t/t5503-tagfollow.sh b/t/t5503-tagfollow.sh index febe441041..31ec352c5c 100755 --- a/t/t5503-tagfollow.sh +++ b/t/t5503-tagfollow.sh @@ -32,7 +32,7 @@ test_expect_success setup ' ( mkdir cloned && cd cloned && - git init-db && + git init && git remote add -f origin .. ) && -- 2.54.0.926.g75ba10bac6.dirty