]> git.ipfire.org Git - thirdparty/git.git/commitdiff
whatchanged: remove when built with WITH_BREAKING_CHANGES
authorJunio C Hamano <gitster@pobox.com>
Mon, 12 May 2025 19:03:10 +0000 (12:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 May 2025 22:30:12 +0000 (15:30 -0700)
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
Documentation/config/log.adoc
Documentation/pretty-options.adoc
Documentation/rev-list-options.adoc
Documentation/technical/sparse-checkout.adoc
builtin/log.c
git.c
t/t4013-diff-various.sh
t/t4202-log.sh

index 7410e930e530fdf4b795da076dc6a3b3f1f4b0f1..ab0710e86a3e2ca7d0724e174213cada4a611cb4 100644 (file)
@@ -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
index 9003a8219143ab75524391303df2f88ca8922e86..a9b160e7dee4ef26471050c0019d39482d52cbd8 100644 (file)
@@ -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::
index 23888cd612c9fb0c18ac1e24ac56a1a6f2a0a149..b36e96abe28abfae010689fe1bab8366f586cd54 100644 (file)
@@ -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.
 +
index 785c0786e0cf2c141ac40df82e675e4cd5fe74c8..ee5c5c9489491a960637c9530adca46574cc796b 100644 (file)
@@ -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[]
index d9686593548b5ecbc1e1a1eafbf23d9f605dc395..67134bb768a1827539c29b6361ff416b12fb3554 100644 (file)
@@ -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
index 0f98ac8a348208764ada3795b85fac670d5d5315..1d0ae645abef2af5d915a6fd6b54053a2beb814c 100644 (file)
@@ -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 450d6aaa863de4a0ed6bd51366ef262cf51c88fc..b84db92cb5ef658c90f4bd0c572edd8b7668e929 100644 (file)
--- 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 },
 };
index 8caab2ee383cefde573ce65f52cb5415e21f8338..8e38df16858d4ae70fc37158a323b943bd9f18c0 100755 (executable)
@@ -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
 '
index ce4c7ab2af238ce01427c4d0b69b46c8deeefc32..ad05f6772f7371f091518864edf2cf046f8b9cf3 100755 (executable)
@@ -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' '