git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 5/6] whatchanged: remove when built with WITH_BREAKING_CHANGES

From
Junio C Hamano <gitster@pobox.com>
Date
May 3, 2025, 00:58 UTC
Message-ID
<20250503005814.3030099-6-gitster@pobox.com>
In-Reply-To
<20250503005814.3030099-1-gitster@pobox.com>

As we made "git whatchanged" require "--i-still-use-this" and asked the users to report if they still want to use it, the logical next step is to allow us build Git without "whatchanged" to prepare for its eventual removal.

If we were to follow the pattern established in 8ccc75c2 (remote: announce removal of "branches/" and "remotes/", 2025-01-22), we can do this together with the documentation update to officially list that the command will be removed in the BreakingChanges document, but let's just keep the changes separate just in case we want to proceed a bit slower.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/config/format.adoc             |  6 +++++
 Documentation/config/log.adoc                | 11 ++++++--
 Documentation/pretty-options.adoc            |  5 ++++
 Documentation/rev-list-options.adoc          |  9 +++++--
 Documentation/technical/sparse-checkout.adoc |  2 +-
 builtin/log.c                                |  6 +++++
 git.c                                        |  2 ++
 t/t4013-diff-various.sh                      | 12 +++++++--
 t/t4202-log.sh                               | 28 ++++++++++++++------
 9 files changed, 66 insertions(+), 15 deletions(-)
diff --git a/Documentation/config/format.adoc b/Documentation/config/format.adoc
index 7410e930e5..ab0710e86a 100644
--- a/Documentation/config/format.adoc
+++ b/Documentation/config/format.adoc
@@ -68,9 +68,15 @@ format.encodeEmailHeaders::
 	Defaults to true.
 
 format.pretty::
+ifndef::with-breaking-changes[]
 	The default pretty format for log/show/whatchanged command.
 	See linkgit:git-log[1], linkgit:git-show[1],
 	linkgit:git-whatchanged[1].
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+	The default pretty format for log/show command.
+	See linkgit:git-log[1], linkgit:git-show[1].
+endif::with-breaking-changes[]
 
 format.thread::
 	The default threading style for 'git format-patch'.  Can be
diff --git a/Documentation/config/log.adoc b/Documentation/config/log.adoc
index 9003a82191..a9b160e7de 100644
--- a/Documentation/config/log.adoc
+++ b/Documentation/config/log.adoc
@@ -1,6 +1,13 @@
 log.abbrevCommit::
-	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
-	linkgit:git-whatchanged[1] assume `--abbrev-commit`. You may
+	If true, makes
+ifndef::with-breaking-changes[]
+	linkgit:git-log[1], linkgit:git-show[1], and
+	linkgit:git-whatchanged[1]
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+	linkgit:git-log[1] and linkgit:git-show[1]
+endif::with-breaking-changes[]
+	assume `--abbrev-commit`. You may
 	override this option with `--no-abbrev-commit`.
 
 log.date::
diff --git a/Documentation/pretty-options.adoc b/Documentation/pretty-options.adoc
index 23888cd612..b36e96abe2 100644
--- a/Documentation/pretty-options.adoc
+++ b/Documentation/pretty-options.adoc
@@ -62,7 +62,12 @@ ifndef::git-rev-list[]
 --notes[=<ref>]::
 	Show the notes (see linkgit:git-notes[1]) that annotate the
 	commit, when showing the commit log message.  This is the default
+ifndef::with-breaking-changes[]
 	for `git log`, `git show` and `git whatchanged` commands when
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+	for `git log` and `git show` commands when
+endif::with-breaking-changes[]
 	there is no `--pretty`, `--format`, or `--oneline` option given
 	on the command line.
 +
diff --git a/Documentation/rev-list-options.adoc b/Documentation/rev-list-options.adoc
index 785c0786e0..ee5c5c9489 100644
--- a/Documentation/rev-list-options.adoc
+++ b/Documentation/rev-list-options.adoc
@@ -1074,8 +1074,13 @@ Commit Formatting
 
 ifdef::git-rev-list[]
 Using these options, linkgit:git-rev-list[1] will act similar to the
-more specialized family of commit log tools: linkgit:git-log[1],
-linkgit:git-show[1], and linkgit:git-whatchanged[1]
+more specialized family of commit log tools:
+ifndef::with-breaking-changes[]
+linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1].
+endif::with-breaking-changes[]
+ifdef::with-breaking-changes[]
+linkgit:git-log[1] and linkgit:git-show[1].
+endif::with-breaking-changes[]
 endif::git-rev-list[]
 
 include::pretty-options.adoc[]
diff --git a/Documentation/technical/sparse-checkout.adoc b/Documentation/technical/sparse-checkout.adoc
index d968659354..67134bb768 100644
--- a/Documentation/technical/sparse-checkout.adoc
+++ b/Documentation/technical/sparse-checkout.adoc
@@ -442,7 +442,7 @@ understanding these differences can be beneficial.
       * blame (only matters when one or more -C flags are passed)
 	* and annotate
       * log
-      * whatchanged
+      * whatchanged (may not exist anymore)
       * ls-files
       * diff-index
       * diff-tree
diff --git a/builtin/log.c b/builtin/log.c
index 0f98ac8a34..1d0ae645ab 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -114,12 +114,14 @@ struct log_config {
 	char *fmt_pretty;
 	char *default_date_mode;
 
+#ifndef WITH_BREAKING_CHANGES
 	/*
 	 * Note: git_log_config() does not touch this member and that
 	 * is very deliberate.  This member is only to be used to
 	 * resurrect whatchanged that is deprecated.
 	 */
 	int i_still_use_this;
+#endif
 };
 
 static void log_config_init(struct log_config *cfg)
@@ -274,8 +276,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
 		OPT__QUIET(&quiet, N_("suppress diff output")),
 		OPT_BOOL(0, "source", &source, N_("show source")),
 		OPT_BOOL(0, "use-mailmap", &mailmap, N_("use mail map file")),
+#ifndef WITH_BREAKING_CHANGES
 		OPT_HIDDEN_BOOL(0, "i-still-use-this", &cfg->i_still_use_this,
 				"<use this deprecated command>"),
+#endif
 		OPT_ALIAS(0, "mailmap", "use-mailmap"),
 		OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL,
 			       N_("clear all previously-defined decoration filters"),
@@ -642,6 +646,7 @@ static int git_log_config(const char *var, const char *value,
 	return git_diff_ui_config(var, value, ctx, cb);
 }
 
+#ifndef WITH_BREAKING_CHANGES
 int cmd_whatchanged(int argc,
 		    const char **argv,
 		    const char *prefix,
@@ -678,6 +683,7 @@ int cmd_whatchanged(int argc,
 	log_config_release(&cfg);
 	return ret;
 }
+#endif
 
 static void show_tagger(const char *buf, struct rev_info *rev)
 {
diff --git a/git.c b/git.c
index 450d6aaa86..b84db92cb5 100644
--- a/git.c
+++ b/git.c
@@ -645,7 +645,9 @@ static struct cmd_struct commands[] = {
 	{ "verify-pack", cmd_verify_pack },
 	{ "verify-tag", cmd_verify_tag, RUN_SETUP },
 	{ "version", cmd_version },
+#ifndef WITH_BREAKING_CHANGES
 	{ "whatchanged", cmd_whatchanged, RUN_SETUP },
+#endif
 	{ "worktree", cmd_worktree, RUN_SETUP },
 	{ "write-tree", cmd_write_tree, RUN_SETUP },
 };
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 8caab2ee38..8e38df1685 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -200,7 +200,15 @@ do
 	expect="$TEST_DIRECTORY/t4013/diff.$test"
 	actual="$pfx-diff.$test"
 
-	test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
+	case "$cmd" in
+	whatchanged | whatchanged" "*)
+		prereq=WITHOUT_BREAKING_CHANGES
+		;;
+	*)
+		prereq=;;
+	esac
+
+	test_expect_success $prereq "git $cmd # magic is ${magic:-(not used)}" '
 		{
 			echo "$ git $cmd"
 
@@ -462,7 +470,7 @@ diff-tree --stat --compact-summary initial mode
 diff-tree -R --stat --compact-summary initial mode
 EOF
 
-test_expect_success 'whatchanged needs --i-still-use-this' '
+test_expect_success WITHOUT_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' '
 	test_must_fail git whatchanged >message 2>&1 &&
 	test_grep "nominated for removal" message
 '
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index ce4c7ab2af..ad05f6772f 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -486,7 +486,12 @@ test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurati
 	)
 '
 
-for cmd in show whatchanged reflog format-patch
+cmds="show reflog format-patch"
+if test_have_prereq WITHOUT_BREAKING_CHANGES
+then
+	cmds="$cmds whatchanged"
+fi
+for cmd in $cmds
 do
 	case "$cmd" in
 	format-patch) myarg="HEAD~.." ;;
@@ -1202,7 +1207,7 @@ test_expect_success 'reflog is expected format' '
 	test_cmp expect actual
 '
 
-test_expect_success 'whatchanged is expected format' '
+test_expect_success WITHOUT_BREAKING_CHANGES 'whatchanged is expected format' '
 	whatchanged="whatchanged --i-still-use-this" &&
 	git log --no-merges --raw >expect &&
 	git $whatchanged >actual &&
@@ -1217,8 +1222,12 @@ test_expect_success 'log.abbrevCommit configuration' '
 	git log --pretty=raw >expect.log.raw &&
 	git reflog --abbrev-commit >expect.reflog.abbrev &&
 	git reflog --no-abbrev-commit >expect.reflog.full &&
-	git $whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
-	git $whatchanged --no-abbrev-commit >expect.whatchanged.full &&
+
+	if test_have_prereq WITHOUT_BREAKING_CHANGES
+	then
+		git $whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
+		git $whatchanged --no-abbrev-commit >expect.whatchanged.full
+	fi &&
 
 	test_config log.abbrevCommit true &&
 
@@ -1235,10 +1244,13 @@ test_expect_success 'log.abbrevCommit configuration' '
 	git reflog --no-abbrev-commit >actual &&
 	test_cmp expect.reflog.full actual &&
 
-	git $whatchanged >actual &&
-	test_cmp expect.whatchanged.abbrev actual &&
-	git $whatchanged --no-abbrev-commit >actual &&
-	test_cmp expect.whatchanged.full actual
+	if test_have_prereq WITHOUT_BREAKING_CHANGES
+	then
+		git $whatchanged >actual &&
+		test_cmp expect.whatchanged.abbrev actual &&
+		git $whatchanged --no-abbrev-commit >actual &&
+		test_cmp expect.whatchanged.full actual
+	fi
 '
 
 test_expect_success '--abbrev-commit with core.abbrev=false' '
-- 
2.49.0-601-ga5925c3955
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 24 of 39 in “Nominating "whatchanged" for removal”
  1. 0/2 Nominating "whatchanged" for removalJunio C Hamano, May 1, 2025
  2. 1/2 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 1, 2025
  3. 2/2 whatchanged: require --i-still-use-thisJunio C Hamano, May 1, 2025
  4. Junio C HamanoMay 1, 2025
  5. 0/2 Nominating "whatchanged" for removalJunio C Hamano, May 1, 2025
  6. 1/2 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 1, 2025
  7. 2/2 whatchanged: require --i-still-use-thisJunio C Hamano, May 1, 2025
  8. Patrick SteinhardtMay 2, 2025
  9. Junio C HamanoMay 2, 2025
  10. Patrick SteinhardtMay 5, 2025
  11. Patrick SteinhardtMay 2, 2025
  12. Junio C HamanoMay 2, 2025
  13. 0/6 Nominating "whatchanged" for removalJunio C Hamano, May 3, 2025
  14. 1/6 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 3, 2025
  15. Elijah NewrenMay 12, 2025
  16. 2/6 doc: prepare for a world without whatchangedJunio C Hamano, May 3, 2025
  17. Elijah NewrenMay 12, 2025
  18. 3/6 tests: prepare for a world without whatchangedJunio C Hamano, May 3, 2025
  19. Patrick SteinhardtMay 5, 2025
  20. Elijah NewrenMay 12, 2025
  21. 4/6 whatchanged: require --i-still-use-thisJunio C Hamano, May 3, 2025
  22. Patrick SteinhardtMay 5, 2025
  23. Junio C HamanoMay 5, 2025
  24. 5/6 whatchanged: remove when built with WITH_BREAKING_CHANGESJunio C Hamano, May 3, 2025
  25. Patrick SteinhardtMay 5, 2025
  26. Junio C HamanoMay 5, 2025
  27. 6/6 whatschanged: list it in BreakingChanges documentJunio C Hamano, May 3, 2025
  28. Elijah NewrenMay 12, 2025
  29. Junio C HamanoMay 12, 2025
  30. 0/6 Nominating "whatchanged" for removalJunio C Hamano, May 12, 2025
  31. 1/6 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 12, 2025
  32. 2/6 doc: prepare for a world without whatchangedJunio C Hamano, May 12, 2025
  33. 3/6 tests: prepare for a world without whatchangedJunio C Hamano, May 12, 2025
  34. 4/6 whatchanged: require --i-still-use-thisJunio C Hamano, May 12, 2025
  35. Junio C HamanoMay 14, 2025
  36. 5/6 whatchanged: remove when built with WITH_BREAKING_CHANGESJunio C Hamano, May 12, 2025
  37. 6/6 whatschanged: list it in BreakingChanges documentJunio C Hamano, May 12, 2025
  38. Elijah NewrenMay 12, 2025
  39. Junio C HamanoMay 12, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.