Nominating "whatchanged" for removal
Subsystems (2)
cover Nominating "whatchanged" for removal
This does not go far enough to touch the "Git 3.0 removal" list in Documentation/BreakingChanges.adoc, but is a preparatory step necessary if we ever wanted to do so in the future.
The first step is to split out the long "we marked this for removal. tell us at [email protected] if you still use it, and in the meantime we refuse to proceed without --i-still-use-this" message out of "git pack-redundant" implementation and makes it reusable.
The second step is to use that helper to mark "git whatchanged" for removal.
Junio C Hamano (2):
you-still-use-that??: help deprecating commands for removal
whatchanged: require --i-still-use-this
Documentation/git-whatchanged.adoc | 10 ++++++++-- builtin/log.c | 13 +++++++++++++ builtin/pack-redundant.c | 10 ++-------- git-compat-util.h | 2 ++ t/t4013-diff-various.sh | 17 +++++++++++++++-- t/t5323-pack-redundant.sh | 5 +++++ usage.c | 12 ++++++++++++ 7 files changed, 57 insertions(+), 12 deletions(-)
Signature · 1 line
2.49.0-599-g90c2cffacf
PATCH 1/2 you-still-use-that??: help deprecating commands for removal
A command slated for removal like "git pack-redundant" gains a command line option "--i-still-use-this", and refuses to work when the option is not given. The message and the instruction upon seeing what to do are both rather long, so before letting another command to use the same mechanism, factor out the message+die part into a small helper function, and use that.
The existing pack-redundant test lacked a test to make sure that we require the --i-still-use-this option. Add one while we are at it.
--- builtin/pack-redundant.c | 10 ++-------- git-compat-util.h | 2 ++ t/t5323-pack-redundant.sh | 5 +++++ usage.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 8 deletions(-)
builtin/pack-redundant.c +2 -8
@@ -625,14 +625,8 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, sbreak ; } -if (!i_still_use_this) { -fputs (_ ("'git pack-redundant' is nominated for removal.\n" -"If you still use this command, please add an extra\n" -"option, '--i-still-use-this', on the command line\n" -"and let us know you still use it by sending an e-mail\n" -"to <[email protected]>. Thanks.\n" ), stderr); -die (_ ("refusing to run without --i-still-use-this" )); - } +if (!i_still_use_this) +you_still_use_that ("git pack-redundant" );if (load_all_packs)load_all ();
git-compat-util.h +2 -0
@@ -703,6 +703,8 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));void show_usage_if_asked (int ac,const char **av,const char *err); +NORETURN void you_still_use_that(const char *command_name); +#ifndef NO_OPENSSL #ifdef APPLE_COMMON_CRYPTO #include "compat/apple-common-crypto.h"
t/t5323-pack-redundant.sh +5 -0
@@ -45,6 +45,11 @@ fi main_repo=main.git shared_repo=shared.git +test_expect_success 'pack-redundant needs --i-still-use-this' ' + test_must_fail git pack-redundant >message 2>&1 && + test_grep "nominated for removal" message +' + git_pack_redundant='git pack-redundant --i-still-use-this' # Create commits in <repo> and assign each commit's oid to shell variables
usage.c +12 -0
@@ -372,3 +372,15 @@ void bug_fl(const char *file, int line, const char *fmt, ...)trace2_cmd_error_va (fmt, ap);va_end (ap); } + +NORETURN void you_still_use_that(const char *command_name) +{ +fprintf (stderr, +_ ("'%s' is nominated for removal.\n" +"If you still use this command, please add an extra\n" +"option, '--i-still-use-this', on the command line\n" +"and let us know you still use it by sending an e-mail\n" +"to <[email protected]>. Thanks.\n" ), + command_name); +die (_ ("refusing to run without --i-still-use-this" )); +}
Signature · 1 line
2.49.0-599-g90c2cffacf
PATCH 2/2 whatchanged: require --i-still-use-this
In reply to Junio C HamanoThe documentation of "git whatchanged" is pretty explicit that this has retained for historical reasons to help those whose fingers cannot be retrained. Let's see if they still are finding it hard to type "git log --raw" instead of "git whatchanged" by marking the command as "nominated for removal", and require "--i-still-use-this" on the command line.
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
--- Documentation/git-whatchanged.adoc | 10 ++++++++-- builtin/log.c | 13 +++++++++++++ t/t4013-diff-various.sh | 17 +++++++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-)
Documentation/git-whatchanged.adoc +8 -2
@@ -8,8 +8,14 @@ git-whatchanged - Show logs with differences each commit introduces SYNOPSIS -------- -[verse] -'git whatchanged' <option>... +[synopsis] +git whatchanged <option>... + +WARNING +------- +`git whatchanged` has been deprecated and is scheduled for removal in +a future version of Git, as it is merely `git log` with different +default; `whatchanged` is not even shorter to type than `log --raw`. DESCRIPTION -----------
builtin/log.c +13 -0
@@ -113,6 +113,13 @@ struct log_config {int fmt_patch_name_max;char *fmt_pretty;char *default_date_mode; + +/* +* 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; };static void log_config_init (struct log_config *cfg)
@@ -267,6 +274,8 @@ 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" )), +OPT_HIDDEN_BOOL (0 ,"i-still-use-this" , &cfg->i_still_use_this, +"<use this deprecated command>" ),OPT_ALIAS (0 ,"mailmap" ,"use-mailmap" ), OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL, N_("clear all previously-defined decoration filters"),
@@ -656,6 +665,10 @@ int cmd_whatchanged(int argc, opt.def ="HEAD" ; opt.revarg_opt =REVARG_COMMITTISH ;cmd_log_init (argc, argv, prefix, &rev, &opt, &cfg); + +if (!cfg.i_still_use_this) +you_still_use_that ("git whatchanged" ); +if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_RAW ;
t/t4013-diff-various.sh +15 -2
@@ -203,11 +203,19 @@ do test_expect_success "git $cmd # magic is ${magic:-(not used)}" ' { echo "$ git $cmd" + + case "$cmd" in + whatchanged | whatchanged" "*) + run="whatchanged --i-still-use-this" + run="$run ${cmd#whatchanged}" ;; + *) + run=$cmd ;; + esac && case "$magic" in "") - GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;; + GIT_PRINT_SHA1_ELLIPSIS=yes git $run ;; noellipses) - git $cmd ;; + git $run ;; esac | sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \ -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
@@ -454,6 +462,11 @@ 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_must_fail git whatchanged >message 2>&1 && + test_grep "nominated for removal" message +' + test_expect_success 'log -m matches pure log' ' git log master >result && process_diffs result >expected &&
Signature · 1 line
2.49.0-599-g90c2cffacf
Re: [PATCH 2/2] whatchanged: require --i-still-use-this
Quoted 10 lines · Junio C Hamano
The documentation of "git whatchanged" is pretty explicit that this has retained for historical reasons to help those whose fingers cannot be retrained. Let's see if they still are finding it hard to type "git log --raw" instead of "git whatchanged" by marking the command as "nominated for removal", and require "--i-still-use-this" on the command line.
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
Quoted 6 lines
Signed-off-by Junio C Hamano <[email protected]>--- Documentation/git-whatchanged.adoc | 10 ++++++++-- builtin/log.c | 13 +++++++++++++ t/t4013-diff-various.sh | 17 +++++++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-)
This needs a bit more adjustments to the tests. Namely
- t4202-log needs to pass --i-still-use-this because the test wants to check the output from the command when it functions;
- t9300-fast-import needs to run "log --raw" instead, as the output from the existing call to "whatchanged" is simply discarded and not checked at all. We could remove the call to "whatchanged" whose output is not even tested.
Also as we haven't listed the removal of this command in the 3.0 breaking changes document, we do not support WITH_BREAKING_CHANGES build knob and test prerequisites yet.
v2 cover Nominating "whatchanged" for removal
In reply to Junio C HamanoThis does not go far enough to touch the "Git 3.0 removal" list in Documentation/BreakingChanges.adoc, but is a preparatory step necessary if we ever wanted to do so in the future.
The first step is to split out the long "we marked this for removal. tell us at [email protected] if you still use it, and in the meantime we refuse to proceed without --i-still-use-this" message out of "git pack-redundant" implementation and makes it reusable.
The second step is to use that helper to mark "git whatchanged" for removal.
Relative to the previous iteration, the only change is necessary adjustment of tests that use "git whatchanged". The ones that validate the output of "whatchanged" are updated to pass the necessary "--i-still-use-this", and the ones that runs "whatchanged" while testing other commands are rewritten to use "log --raw".
Junio C Hamano (2):
you-still-use-that??: help deprecating commands for removal
whatchanged: require --i-still-use-this
Documentation/git-whatchanged.adoc | 10 ++++++++-- builtin/log.c | 13 +++++++++++++ builtin/pack-redundant.c | 10 ++-------- git-compat-util.h | 2 ++ t/t4013-diff-various.sh | 17 +++++++++++++++-- t/t4202-log.sh | 14 +++++++++----- t/t5323-pack-redundant.sh | 5 +++++ t/t9300-fast-import.sh | 12 ++++++------ t/t9301-fast-import-notes.sh | 2 +- usage.c | 12 ++++++++++++ 10 files changed, 73 insertions(+), 24 deletions(-)
Range-diff against v1:
1: 2e4e3906b1 = 1: 2e4e3906b1 you-still-use-that??: help deprecating commands for removal 2: 43eb8ec0a8 ! 2: 622456481b whatchanged: require --i-still-use-this
@@ Commit message
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
+ Two test scripts on fast-import run "git whatchanged" without even
+ checking the output from it. It might still help manual debugging
+ so I've replaced these calls with "git log --raw", but we probably
+ are better off removing such useless git operations that do not
+ contribute to the tests. Such a clean-up is left outside the scope
+ of this patch.
+
## Documentation/git-whatchanged.adoc ##
@@ t/t4013-diff-various.sh: diff-tree --stat --compact-summary initial mode
test_expect_success 'log -m matches pure log' '
git log master >result &&
process_diffs result >expected &&
+
+ ## t/t4202-log.sh ##
+@@ t/t4202-log.sh: for cmd in show whatchanged reflog format-patch
+ do
+ case "$cmd" in
+ format-patch) myarg="HEAD~.." ;;
++ whatchanged) myarg=--i-still-use-this ;;
+ *) myarg= ;;
+ esac
+
+@@ t/t4202-log.sh: test_expect_success 'reflog is expected format' '
+ '
+
+ test_expect_success 'whatchanged is expected format' '
++ whatchanged="whatchanged --i-still-use-this" &&
+ git log --no-merges --raw >expect &&
+- git whatchanged >actual &&
++ git $whatchanged >actual &&
+ test_cmp expect actual
+ '
+
+ test_expect_success 'log.abbrevCommit configuration' '
++ whatchanged="whatchanged --i-still-use-this" &&
++
+ git log --abbrev-commit >expect.log.abbrev &&
+ git log --no-abbrev-commit >expect.log.full &&
+ 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 &&
++ git $whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
++ git $whatchanged --no-abbrev-commit >expect.whatchanged.full &&
+
+ test_config log.abbrevCommit true &&
+
+@@ t/t4202-log.sh: test_expect_success 'log.abbrevCommit configuration' '
+ git reflog --no-abbrev-commit >actual &&
+ test_cmp expect.reflog.full actual &&
+
+- git whatchanged >actual &&
++ git $whatchanged >actual &&
+ test_cmp expect.whatchanged.abbrev actual &&
+- git whatchanged --no-abbrev-commit >actual &&
++ git $whatchanged --no-abbrev-commit >actual &&
+ test_cmp expect.whatchanged.full actual
+ '
+
+
+ ## t/t9300-fast-import.sh ##
+@@ t/t9300-fast-import.sh: test_expect_success 'A: create pack from stdin' '
+
+ INPUT_END
+ git fast-import --export-marks=marks.out <input &&
+- git whatchanged main
++ git log --raw main
+ '
+
+ test_expect_success 'A: verify pack' '
+@@ t/t9300-fast-import.sh: test_expect_success 'A: verify marks import does not crash' '
+ INPUT_END
+
+ git fast-import --import-marks=marks.out <input &&
+- git whatchanged verify--import-marks
++ git log --raw verify--import-marks
+ '
+
+ test_expect_success 'A: verify pack' '
+@@ t/t9300-fast-import.sh: test_expect_success 'C: incremental import create pack from stdin' '
+ INPUT_END
+
+ git fast-import <input &&
+- git whatchanged branch
++ git log --raw branch
+ '
+
+ test_expect_success 'C: verify pack' '
+@@ t/t9300-fast-import.sh: test_expect_success 'D: inline data in commit' '
+ INPUT_END
+
+ git fast-import <input &&
+- git whatchanged branch
++ git log --raw branch
+ '
+
+ test_expect_success 'D: verify pack' '
+@@ t/t9300-fast-import.sh: test_expect_success 'H: deletall, add 1' '
+
+ INPUT_END
+ git fast-import <input &&
+- git whatchanged H
++ git log --raw H
+ '
+
+ test_expect_success 'H: verify pack' '
+@@ t/t9300-fast-import.sh: test_expect_success 'Q: commit notes' '
+ INPUT_END
+
+ git fast-import <input &&
+- git whatchanged notes-test
++ git log --raw notes-test
+ '
+
+ test_expect_success 'Q: verify pack' '
+
+ ## t/t9301-fast-import-notes.sh ##
+@@ t/t9301-fast-import-notes.sh: INPUT_END
+ test_expect_success 'set up main branch' '
+
+ git fast-import <input &&
+- git whatchanged main
++ git log --raw main
+ '
+
+ commit4=$(git rev-parse refs/heads/main)
Signature · 1 line
2.49.0-599-gc9a5c860a0
PATCH v2 1/2 you-still-use-that??: help deprecating commands for removal
A command slated for removal like "git pack-redundant" gains a command line option "--i-still-use-this", and refuses to work when the option is not given. The message and the instruction upon seeing what to do are both rather long, so before letting another command to use the same mechanism, factor out the message+die part into a small helper function, and use that.
The existing pack-redundant test lacked a test to make sure that we require the --i-still-use-this option. Add one while we are at it.
--- builtin/pack-redundant.c | 10 ++-------- git-compat-util.h | 2 ++ t/t5323-pack-redundant.sh | 5 +++++ usage.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 8 deletions(-)
builtin/pack-redundant.c +2 -8
@@ -625,14 +625,8 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, sbreak ; } -if (!i_still_use_this) { -fputs (_ ("'git pack-redundant' is nominated for removal.\n" -"If you still use this command, please add an extra\n" -"option, '--i-still-use-this', on the command line\n" -"and let us know you still use it by sending an e-mail\n" -"to <[email protected]>. Thanks.\n" ), stderr); -die (_ ("refusing to run without --i-still-use-this" )); - } +if (!i_still_use_this) +you_still_use_that ("git pack-redundant" );if (load_all_packs)load_all ();
git-compat-util.h +2 -0
@@ -703,6 +703,8 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));void show_usage_if_asked (int ac,const char **av,const char *err); +NORETURN void you_still_use_that(const char *command_name); +#ifndef NO_OPENSSL #ifdef APPLE_COMMON_CRYPTO #include "compat/apple-common-crypto.h"
t/t5323-pack-redundant.sh +5 -0
@@ -45,6 +45,11 @@ fi main_repo=main.git shared_repo=shared.git +test_expect_success 'pack-redundant needs --i-still-use-this' ' + test_must_fail git pack-redundant >message 2>&1 && + test_grep "nominated for removal" message +' + git_pack_redundant='git pack-redundant --i-still-use-this' # Create commits in <repo> and assign each commit's oid to shell variables
usage.c +12 -0
@@ -372,3 +372,15 @@ void bug_fl(const char *file, int line, const char *fmt, ...)trace2_cmd_error_va (fmt, ap);va_end (ap); } + +NORETURN void you_still_use_that(const char *command_name) +{ +fprintf (stderr, +_ ("'%s' is nominated for removal.\n" +"If you still use this command, please add an extra\n" +"option, '--i-still-use-this', on the command line\n" +"and let us know you still use it by sending an e-mail\n" +"to <[email protected]>. Thanks.\n" ), + command_name); +die (_ ("refusing to run without --i-still-use-this" )); +}
Signature · 1 line
2.49.0-599-gc9a5c860a0
PATCH v2 2/2 whatchanged: require --i-still-use-this
In reply to Junio C HamanoThe documentation of "git whatchanged" is pretty explicit that this has retained for historical reasons to help those whose fingers cannot be retrained. Let's see if they still are finding it hard to type "git log --raw" instead of "git whatchanged" by marking the command as "nominated for removal", and require "--i-still-use-this" on the command line.
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
Two test scripts on fast-import run "git whatchanged" without even checking the output from it. It might still help manual debugging so I've replaced these calls with "git log --raw", but we probably are better off removing such useless git operations that do not contribute to the tests. Such a clean-up is left outside the scope of this patch.
--- Documentation/git-whatchanged.adoc | 10 ++++++++-- builtin/log.c | 13 +++++++++++++ t/t4013-diff-various.sh | 17 +++++++++++++++-- t/t4202-log.sh | 14 +++++++++----- t/t9300-fast-import.sh | 12 ++++++------ t/t9301-fast-import-notes.sh | 2 +- 6 files changed, 52 insertions(+), 16 deletions(-)
Documentation/git-whatchanged.adoc +8 -2
@@ -8,8 +8,14 @@ git-whatchanged - Show logs with differences each commit introduces SYNOPSIS -------- -[verse] -'git whatchanged' <option>... +[synopsis] +git whatchanged <option>... + +WARNING +------- +`git whatchanged` has been deprecated and is scheduled for removal in +a future version of Git, as it is merely `git log` with different +default; `whatchanged` is not even shorter to type than `log --raw`. DESCRIPTION -----------
builtin/log.c +13 -0
@@ -113,6 +113,13 @@ struct log_config {int fmt_patch_name_max;char *fmt_pretty;char *default_date_mode; + +/* +* 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; };static void log_config_init (struct log_config *cfg)
@@ -267,6 +274,8 @@ 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" )), +OPT_HIDDEN_BOOL (0 ,"i-still-use-this" , &cfg->i_still_use_this, +"<use this deprecated command>" ),OPT_ALIAS (0 ,"mailmap" ,"use-mailmap" ), OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL, N_("clear all previously-defined decoration filters"),
@@ -656,6 +665,10 @@ int cmd_whatchanged(int argc, opt.def ="HEAD" ; opt.revarg_opt =REVARG_COMMITTISH ;cmd_log_init (argc, argv, prefix, &rev, &opt, &cfg); + +if (!cfg.i_still_use_this) +you_still_use_that ("git whatchanged" ); +if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_RAW ;
t/t4013-diff-various.sh +15 -2
@@ -203,11 +203,19 @@ do test_expect_success "git $cmd # magic is ${magic:-(not used)}" ' { echo "$ git $cmd" + + case "$cmd" in + whatchanged | whatchanged" "*) + run="whatchanged --i-still-use-this" + run="$run ${cmd#whatchanged}" ;; + *) + run=$cmd ;; + esac && case "$magic" in "") - GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;; + GIT_PRINT_SHA1_ELLIPSIS=yes git $run ;; noellipses) - git $cmd ;; + git $run ;; esac | sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \ -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
@@ -454,6 +462,11 @@ 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_must_fail git whatchanged >message 2>&1 && + test_grep "nominated for removal" message +' + test_expect_success 'log -m matches pure log' ' git log master >result && process_diffs result >expected &&
t/t4202-log.sh +9 -5
@@ -490,6 +490,7 @@ for cmd in show whatchanged reflog format-patch do case "$cmd" in format-patch) myarg="HEAD~.." ;; + whatchanged) myarg=--i-still-use-this ;; *) myarg= ;; esac
@@ -1202,19 +1203,22 @@ test_expect_success 'reflog is expected format' ' ' test_expect_success 'whatchanged is expected format' ' + whatchanged="whatchanged --i-still-use-this" && git log --no-merges --raw >expect && - git whatchanged >actual && + git $whatchanged >actual && test_cmp expect actual ' test_expect_success 'log.abbrevCommit configuration' ' + whatchanged="whatchanged --i-still-use-this" && + git log --abbrev-commit >expect.log.abbrev && git log --no-abbrev-commit >expect.log.full && 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 && + git $whatchanged --abbrev-commit >expect.whatchanged.abbrev && + git $whatchanged --no-abbrev-commit >expect.whatchanged.full && test_config log.abbrevCommit true &&
@@ -1231,9 +1235,9 @@ test_expect_success 'log.abbrevCommit configuration' ' git reflog --no-abbrev-commit >actual && test_cmp expect.reflog.full actual && - git whatchanged >actual && + git $whatchanged >actual && test_cmp expect.whatchanged.abbrev actual && - git whatchanged --no-abbrev-commit >actual && + git $whatchanged --no-abbrev-commit >actual && test_cmp expect.whatchanged.full actual '
t/t9300-fast-import.sh +6 -6
@@ -120,7 +120,7 @@ test_expect_success 'A: create pack from stdin' ' INPUT_END git fast-import --export-marks=marks.out <input && - git whatchanged main + git log --raw main ' test_expect_success 'A: verify pack' '
@@ -279,7 +279,7 @@ test_expect_success 'A: verify marks import does not crash' ' INPUT_END git fast-import --import-marks=marks.out <input && - git whatchanged verify--import-marks + git log --raw verify--import-marks ' test_expect_success 'A: verify pack' '
@@ -652,7 +652,7 @@ test_expect_success 'C: incremental import create pack from stdin' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'C: verify pack' '
@@ -715,7 +715,7 @@ test_expect_success 'D: inline data in commit' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'D: verify pack' '
@@ -882,7 +882,7 @@ test_expect_success 'H: deletall, add 1' ' INPUT_END git fast-import <input && - git whatchanged H + git log --raw H ' test_expect_success 'H: verify pack' '
@@ -2066,7 +2066,7 @@ test_expect_success 'Q: commit notes' ' INPUT_END git fast-import <input && - git whatchanged notes-test + git log --raw notes-test ' test_expect_success 'Q: verify pack' '
t/t9301-fast-import-notes.sh +1 -1
@@ -76,7 +76,7 @@ INPUT_END test_expect_success 'set up main branch' ' git fast-import <input && - git whatchanged main + git log --raw main ' commit4=$(git rev-parse refs/heads/main)
Signature · 1 line
2.49.0-599-gc9a5c860a0
Re: [PATCH v2 2/2] whatchanged: require --i-still-use-this
Quoted 8 lines · Junio C Hamano
builtin/log.c +0
-0@@ -113,6 +113,13 @@ struct log_config {int fmt_patch_name_max;char *fmt_pretty;char *default_date_mode;
builtin/log.c struct log_config { · line 125
Quoted 10 lines
builtin/log.c +7
-0+ +/* +* 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; };static void log_config_init (struct log_config *cfg)
I was briefly wondering why this variable wasn't just declared in cmd_whatchanged(), but that's because parsing is of course done by cmd_log_init_finish(). Nothing worth thinking about too much.
builtin/log.c int cmd_whatchanged(int argc, · line 674
Quoted 11 lines
builtin/log.c +4
-0@@ -656,6 +665,10 @@ int cmd_whatchanged(int argc, opt.def ="HEAD" ; opt.revarg_opt =REVARG_COMMITTISH ;cmd_log_init (argc, argv, prefix, &rev, &opt, &cfg); + +if (!cfg.i_still_use_this) +you_still_use_that ("git whatchanged" ); +if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_RAW ;
I think it would help potential users of this command quite a bit if we explicitly told them what the replacement is. So maybe we can extend you_still_use_that() to accept an explanation?
Patrick
Re: [PATCH v2 2/2] whatchanged: require --i-still-use-this
Quoted 3 lines · Patrick Steinhardt
I was briefly wondering why this variable wasn't just declared in
cmd_whatchanged(), but that's because parsing is of course done bycmd_log_init_finish(). Nothing worth thinking about too much.
Yeah, it is between "cfg that is conveniently passed around the code paths, even though it is not a configuration item" vs "a file-scope static variable that will live until we decide to remove (or keep) the command".
Quoted 7 lines
Quoted 7 lines
builtin/log.c +3
-0@@ -656,6 +665,10 @@ int cmd_whatchanged(int argc, opt.def ="HEAD" ; opt.revarg_opt =REVARG_COMMITTISH ;cmd_log_init (argc, argv, prefix, &rev, &opt, &cfg); + +if (!cfg.i_still_use_this) +you_still_use_that ("git whatchanged" );
Quoted 8 lines
builtin/log.c int cmd_whatchanged(int argc, · line 674
Quoted 4 lines
builtin/log.c +1
-0+if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_RAW ;I think it would help potential users of this command quite a bit if we explicitly told them what the replacement is. So maybe we can extend
you_still_use_that()to accept an explanation?
I doubt it. The reason why we remove something is not "because a better alternative exists"; it is "because everybody *HAS* switched to the better alternative". If we need to educate folks in this message, the plan to remove that command is still premature.
Re: [PATCH v2 2/2] whatchanged: require --i-still-use-this
Quoted 17 lines · Junio C Hamano
Quoted 7 lines · Patrick Steinhardt
Quoted 7 lines
builtin/log.c +3
-0@@ -656,6 +665,10 @@ int cmd_whatchanged(int argc, opt.def ="HEAD" ; opt.revarg_opt =REVARG_COMMITTISH ;cmd_log_init (argc, argv, prefix, &rev, &opt, &cfg); + +if (!cfg.i_still_use_this) +you_still_use_that ("git whatchanged" );Quoted 8 lines
builtin/log.c int cmd_whatchanged(int argc, · line 674
Quoted 4 lines
builtin/log.c +1
-0+if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_RAW ;I think it would help potential users of this command quite a bit if we explicitly told them what the replacement is. So maybe we can extend
you_still_use_that()to accept an explanation?
Quoted 4 lines
I doubt it. The reason why we remove something is not "because a better alternative exists"; it is "because everybody *HAS* switched to the better alternative". If we need to educate folks in this message, the plan to remove that command is still premature.
That's a fair point indeed.
Patrick
Quoted 3 lines · Junio C Hamano
This does not go far enough to touch the "Git 3.0 removal" list in
Documentation/BreakingChanges.adoc, but is a preparatory step necessary if we ever wanted to do so in the future.
I'm a little confused. These patches very much feel like starting the deprecation process for git-whatchanged(1), so why wouldn't we at the same time list it as an upcoming breaking change? Or is the intent rather to figure out whether anybody is still using this command so that we can then deprecate it after a couple releases if we haven't heard back from anybody?
Patrick
Quoted 8 lines · Patrick Steinhardt
Quoted 3 lines · Junio C Hamano
This does not go far enough to touch the "Git 3.0 removal" list in
Documentation/BreakingChanges.adoc, but is a preparatory step necessary if we ever wanted to do so in the future.I'm a little confused. These patches very much feel like starting the deprecation process for git-whatchanged(1), so why wouldn't we at the same time list it as an upcoming breaking change?
Ah, yes, I was overly eager in the documentation change.
To make an analogy of what happened to pack-redundant, this corresponds to c3b58472 (pack-redundant: gauge the usage before proposing its removal, 2020-08-25) plus 4406522b (pack-redundant:
escalate deprecation warning to an error, 2023-03-23) rolled into one. We are gauging the impact of the removal by inconveniencing existing users a big way, with a tiny escape hatch to make them feel the pain, so that we can hear their scream better.
We are not there yet to announce the decision to deprecate, like fcf31daa (pack-redundant: document deprecation, 2023-03-28) did, to those who do not even use the command. I think it may make sense to hold that WARNING part of the change, leaving it to a future step that touches the BreakingChanges document.
Quoted 4 lines
Or is the intent
rather to figure out whether anybody is still using this command so that we can then deprecate it after a couple releases if we haven't heard back from anybody?
Yes, exactly.
Thanks.
v3 cover Nominating "whatchanged" for removal
In reply to Junio C Hamano"git whatchanged" has outlived its usefulness when "git log" with various diff-related options more than 10 years ago. It is not even shorter to type than its rough equivalent "git log --raw". It is high time to start seeing if it is still being used, declare its official deprecation, and announce its removal in the future.
This iteration is more complete than the previous two iterations:
* The first step is to refactor the mechanism to show the message to ask users to contact git@vger that they still use the command, out of "git pack-redundant" implementation. This message is shown when the "--i-still-use-this" option is not passed to a command that requires it.
* The second and the third step are to remove unnecessary mentions of "whatchanged" from our documentation and tests. With these, we have fewer places that we need to adjust when the command gets truly removed.
* Then we start to require that the "--i-still-use-this" option is passed from the command line. This requires adjustment for tests that protect the behaviour of the command, as they must now pass the required option just like end-users.
* The last two steps are for a future. In order to make sure that we can cleanly ditch the feature at some future date by removing it from the build, test, and documentation when Git is built with WITH_BREAKING_CHANGES. And finally we add "whatchanged" to the list of features to be removed in the BreakingChanges document.
Junio C Hamano (6):
you-still-use-that??: help deprecating commands for removal
doc: prepare for a world without whatchanged
tests: prepare for a world without whatchanged
whatchanged: require --i-still-use-this
whatchanged: remove when built with WITH_BREAKING_CHANGES
whatschanged: list it in BreakingChanges document
Documentation/BreakingChanges.adoc | 9 ++++++ Documentation/MyFirstObjectWalk.adoc | 4 +-- Documentation/config/format.adoc | 6 ++++ Documentation/config/log.adoc | 11 +++++-- Documentation/git-whatchanged.adoc | 10 ++++-- Documentation/pretty-options.adoc | 5 +++ Documentation/rev-list-options.adoc | 9 ++++-- Documentation/technical/sparse-checkout.adoc | 2 +- Documentation/user-manual.adoc | 2 +- builtin/log.c | 19 +++++++++++ builtin/pack-redundant.c | 10 ++---- git-compat-util.h | 2 ++ git.c | 2 ++ t/t4013-diff-various.sh | 27 ++++++++++++++-- t/t4202-log.sh | 34 ++++++++++++++------ t/t5323-pack-redundant.sh | 5 +++ t/t9300-fast-import.sh | 12 +++---- t/t9301-fast-import-notes.sh | 2 +- usage.c | 12 +++++++ 19 files changed, 146 insertions(+), 37 deletions(-)
Signature · 1 line
2.49.0-601-ga5925c3955
PATCH v3 1/6 you-still-use-that??: help deprecating commands for removal
A command slated for removal like "git pack-redundant" gains a command line option "--i-still-use-this", and refuses to work when the option is not given. The message and the instruction upon seeing what to do are both rather long, so before letting another command to use the same mechanism, factor out the message+die part into a small helper function, and use that.
The existing pack-redundant test lacked a test to make sure that we require the --i-still-use-this option. Add one while we are at it.
--- builtin/pack-redundant.c | 10 ++-------- git-compat-util.h | 2 ++ t/t5323-pack-redundant.sh | 5 +++++ usage.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 8 deletions(-)
builtin/pack-redundant.c +2 -8
@@ -625,14 +625,8 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, sbreak ; } -if (!i_still_use_this) { -fputs (_ ("'git pack-redundant' is nominated for removal.\n" -"If you still use this command, please add an extra\n" -"option, '--i-still-use-this', on the command line\n" -"and let us know you still use it by sending an e-mail\n" -"to <[email protected]>. Thanks.\n" ), stderr); -die (_ ("refusing to run without --i-still-use-this" )); - } +if (!i_still_use_this) +you_still_use_that ("git pack-redundant" );if (load_all_packs)load_all ();
git-compat-util.h +2 -0
@@ -703,6 +703,8 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));void show_usage_if_asked (int ac,const char **av,const char *err); +NORETURN void you_still_use_that(const char *command_name); +#ifndef NO_OPENSSL #ifdef APPLE_COMMON_CRYPTO #include "compat/apple-common-crypto.h"
t/t5323-pack-redundant.sh +5 -0
@@ -45,6 +45,11 @@ fi main_repo=main.git shared_repo=shared.git +test_expect_success 'pack-redundant needs --i-still-use-this' ' + test_must_fail git pack-redundant >message 2>&1 && + test_grep "nominated for removal" message +' + git_pack_redundant='git pack-redundant --i-still-use-this' # Create commits in <repo> and assign each commit's oid to shell variables
usage.c +12 -0
@@ -372,3 +372,15 @@ void bug_fl(const char *file, int line, const char *fmt, ...)trace2_cmd_error_va (fmt, ap);va_end (ap); } + +NORETURN void you_still_use_that(const char *command_name) +{ +fprintf (stderr, +_ ("'%s' is nominated for removal.\n" +"If you still use this command, please add an extra\n" +"option, '--i-still-use-this', on the command line\n" +"and let us know you still use it by sending an e-mail\n" +"to <[email protected]>. Thanks.\n" ), + command_name); +die (_ ("refusing to run without --i-still-use-this" )); +}
Signature · 1 line
2.49.0-601-ga5925c3955
Re: [PATCH v3 1/6] you-still-use-that??: help deprecating commands for removal
Quoted 10 lines · Junio C Hamano
A command slated for removal like "git pack-redundant" gains a command line option "--i-still-use-this", and refuses to work when the option is not given. The message and the instruction upon seeing what to do are both rather long, so before letting another command to use the same mechanism, factor out the message+die part into a small helper function, and use that.
The existing pack-redundant test lacked a test to make sure that we require the --i-still-use-this option. Add one while we are at it.
The "gains a command line option" made me think you were discussing a change made by this patch, rather than discussing an existing mechanism. Could I spitball an alternative? Maybe something like...
Commands slated for removal, like "git pack-redundant", now require an explicit --i-still-use-this option to run. This discourages casual use and surfaces their pending deprecation to users.
The warning message is long, so we factor it into a helper function (you_still_use_that()) to simplify reuse by other commands.
Also add a missing test to ensure this enforcement works for "pack-redundant".
Quoted 80 lines
Signed-off-by Junio C Hamano <[email protected]>--- builtin/pack-redundant.c | 10 ++-------- git-compat-util.h | 2 ++ t/t5323-pack-redundant.sh | 5 +++++ usage.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 8 deletions(-)builtin/pack-redundant.c +2
-8@@ -625,14 +625,8 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, sbreak ; } -if (!i_still_use_this) { -fputs (_ ("'git pack-redundant' is nominated for removal.\n" -"If you still use this command, please add an extra\n" -"option, '--i-still-use-this', on the command line\n" -"and let us know you still use it by sending an e-mail\n" -"to <[email protected]>. Thanks.\n" ), stderr); -die (_ ("refusing to run without --i-still-use-this" )); - } +if (!i_still_use_this) +you_still_use_that ("git pack-redundant" );if (load_all_packs)load_all ();git-compat-util.h +2
-0@@ -703,6 +703,8 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));void show_usage_if_asked (int ac,const char **av,const char *err); +NORETURN void you_still_use_that(const char *command_name); +#ifndef NO_OPENSSL #ifdef APPLE_COMMON_CRYPTO #include "compat/apple-common-crypto.h" t/t5323-pack-redundant.sh +5
-0@@ -45,6 +45,11 @@ fi main_repo=main.git shared_repo=shared.git +test_expect_success 'pack-redundant needs --i-still-use-this' ' + test_must_fail git pack-redundant >message 2>&1 && + test_grep "nominated for removal" message +' + git_pack_redundant='git pack-redundant --i-still-use-this' # Create commits in <repo> and assign each commit's oid to shell variablesusage.c +12
-1@@ -372,3 +372,15 @@ void bug_fl(const char *file, int line, const char *fmt, ...)trace2_cmd_error_va (fmt, ap);va_end (ap); } + +NORETURN void you_still_use_that(const char *command_name) +{ +fprintf (stderr, +_ ("'%s' is nominated for removal.\n" +"If you still use this command, please add an extra\n" +"option, '--i-still-use-this', on the command line\n" +"and let us know you still use it by sending an e-mail\n" +"to <[email protected]>. Thanks.\n" ), + command_name); +die (_ ("refusing to run without --i-still-use-this" )); +} --
Quoted 1 line
2.49.0-601-ga5925c3955
Patch looks good.
PATCH v3 2/6 doc: prepare for a world without whatchanged
In reply to Junio C HamanoThese documents mention "whatchanged" as an example, that can be substituted by something else. A new hypothetical command "walken" would come near "whatchanged" but since the latter may be going away, we can say it would come near "version", as the fictitious command sorts between them. Similarly, we do not have to use "whatchanged" as an example of a subcommand that is also implemented in builtin/log.c file; we can instead mention "show".
Both of these changes allow us not to worry about adjusting these places when "whatchanged" is finally removed.
--- Documentation/MyFirstObjectWalk.adoc | 4 ++-- Documentation/user-manual.adoc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Documentation/MyFirstObjectWalk.adoc +2 -2
@@ -83,13 +83,13 @@ int cmd_walken(int argc, const char **argv, const char *prefix) } ---- -Also add the relevant line in `builtin.h` near `cmd_whatchanged()`: +Also add the relevant line in `builtin.h` near `cmd_version()`: ---- int cmd_walken(int argc, const char **argv, const char *prefix); ---- -Include the command in `git.c` in `commands[]` near the entry for `whatchanged`, +Include the command in `git.c` in `commands[]` near the entry for `version`, maintaining alphabetical ordering: ----
Documentation/user-manual.adoc +1 -1
@@ -4240,7 +4240,7 @@ command `git`. The source side of a builtin is - an entry in `BUILTIN_OBJECTS` in the `Makefile`. Sometimes, more than one builtin is contained in one source file. For -example, `cmd_whatchanged()` and `cmd_log()` both reside in `builtin/log.c`, +example, `cmd_show()` and `cmd_log()` both reside in `builtin/log.c`, since they share quite a bit of code. In that case, the commands which are _not_ named like the `.c` file in which they live have to be listed in `BUILT_INS` in the `Makefile`.
Signature · 1 line
2.49.0-601-ga5925c3955
Re: [PATCH v3 2/6] doc: prepare for a world without whatchanged
Quoted 3 lines · Junio C Hamano
These documents mention "whatchanged" as an example, that can be substituted by something else.
Perhaps:
These documents mention "whatchanged" as an example, which can be substituted with something else.
?
Quoted 9 lines
A new hypothetical command "walken"
would come near "whatchanged" but since the latter may be going away, we can say it would come near "version", as the fictitious command sorts between them. Similarly, we do not have to use "whatchanged" as an example of a subcommand that is also implemented inbuiltin/log.cfile; we can instead mention "show".Both of these changes allow us not to worry about adjusting these places when "whatchanged" is finally removed.
Could I suggest (now changing my previous suggestion to handle the entire commit message):
doc: prepare for a world without whatchanged
Some documentation examples reference whatchanged, either as a placeholder command or as an example of source structure.
To reduce the need for future edits when whatchanged is removed, these references are replaced with alternatives:
- In MyFirstObjectWalk.adoc, we use version as the nearby anchor point for walken, instead of whatchanged.
- In user-manual.adoc, we now cite show instead of whatchanged as a command that coexists with log in builtin/log.c.
This avoids needing further cleanup when whatchanged is retired.
Quoted 40 lines
Signed-off-by Junio C Hamano <[email protected]>--- Documentation/MyFirstObjectWalk.adoc | 4 ++-- Documentation/user-manual.adoc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)Documentation/MyFirstObjectWalk.adoc +2
-2@@ -83,13 +83,13 @@ int cmd_walken(int argc, const char **argv, const char *prefix) } ---- -Also add the relevant line in `builtin.h` near `cmd_whatchanged()`: +Also add the relevant line in `builtin.h` near `cmd_version()`: ---- int cmd_walken(int argc, const char **argv, const char *prefix); ---- -Include the command in `git.c` in `commands[]` near the entry for `whatchanged`, +Include the command in `git.c` in `commands[]` near the entry for `version`, maintaining alphabetical ordering: ----Documentation/user-manual.adoc +1
-2@@ -4240,7 +4240,7 @@ command `git`. The source side of a builtin is - an entry in `BUILTIN_OBJECTS` in the `Makefile`. Sometimes, more than one builtin is contained in one source file. For -example, `cmd_whatchanged()` and `cmd_log()` both reside in `builtin/log.c`, +example, `cmd_show()` and `cmd_log()` both reside in `builtin/log.c`, since they share quite a bit of code. In that case, the commands which are _not_ named like the `.c` file in which they live have to be listed in `BUILT_INS` in the `Makefile`. --
Quoted 1 line
2.49.0-601-ga5925c3955
Patch looks good.
PATCH v3 3/6 tests: prepare for a world without whatchanged
In reply to Junio C HamanoSome tests on fast-import run "git whatchanged" without even checking the output from the command. It is tempting to remove the calls altogether since they are not doing anything useful, but they presumably were placed while the tests were developped to manually sanity check which paths were touched.
Replace these calls with "git log --raw", which is a rough equivalent in the more modern Git.
This does not remove "git whatchanged", but we no longer have to worry about adjusting these places when we eventually do.
--- t/t9300-fast-import.sh | 12 ++++++------ t/t9301-fast-import-notes.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t9300-fast-import.sh +6 -6
@@ -120,7 +120,7 @@ test_expect_success 'A: create pack from stdin' ' INPUT_END git fast-import --export-marks=marks.out <input && - git whatchanged main + git log --raw main ' test_expect_success 'A: verify pack' '
@@ -279,7 +279,7 @@ test_expect_success 'A: verify marks import does not crash' ' INPUT_END git fast-import --import-marks=marks.out <input && - git whatchanged verify--import-marks + git log --raw verify--import-marks ' test_expect_success 'A: verify pack' '
@@ -652,7 +652,7 @@ test_expect_success 'C: incremental import create pack from stdin' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'C: verify pack' '
@@ -715,7 +715,7 @@ test_expect_success 'D: inline data in commit' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'D: verify pack' '
@@ -882,7 +882,7 @@ test_expect_success 'H: deletall, add 1' ' INPUT_END git fast-import <input && - git whatchanged H + git log --raw H ' test_expect_success 'H: verify pack' '
@@ -2066,7 +2066,7 @@ test_expect_success 'Q: commit notes' ' INPUT_END git fast-import <input && - git whatchanged notes-test + git log --raw notes-test ' test_expect_success 'Q: verify pack' '
t/t9301-fast-import-notes.sh +1 -1
@@ -76,7 +76,7 @@ INPUT_END test_expect_success 'set up main branch' ' git fast-import <input && - git whatchanged main + git log --raw main ' commit4=$(git rev-parse refs/heads/main)
Signature · 1 line
2.49.0-601-ga5925c3955
Re: [PATCH v3 3/6] tests: prepare for a world without whatchanged
Quoted 4 lines · Junio C Hamano
Some tests on fast-import run "git whatchanged" without even checking the output from the command. It is tempting to remove the calls altogether since they are not doing anything useful, but they presumably were placed while the tests were developped to manually
s/developped/developed/
Patrick
Re: [PATCH v3 3/6] tests: prepare for a world without whatchanged
In reply to Junio C HamanoQuoted 5 lines · Junio C Hamano
Some tests on fast-import run "git whatchanged" without even checking the output from the command. It is tempting to remove the calls altogether since they are not doing anything useful, but they presumably were placed while the tests were developped to manually
Perhaps use "invoked" (or "used" or "employed") rather than "placed"? "placed" feels a bit awkward here.
(and there's the developped typo that Patrick already pointed out.)
Quoted 7 lines
sanity check which paths were touched.
Replace these calls with "git log --raw", which is a rough equivalent in the more modern Git.
This does not remove "git whatchanged", but we no longer have to worry about adjusting these places when we eventually do.
Seems like a definite positive change.
Quoted 78 lines
Signed-off-by Junio C Hamano <[email protected]>--- t/t9300-fast-import.sh | 12 ++++++------ t/t9301-fast-import-notes.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)t/t9300-fast-import.sh +6
-6@@ -120,7 +120,7 @@ test_expect_success 'A: create pack from stdin' ' INPUT_END git fast-import --export-marks=marks.out <input && - git whatchanged main + git log --raw main ' test_expect_success 'A: verify pack' '@@ -279,7 +279,7 @@ test_expect_success 'A: verify marks import does not crash' ' INPUT_END git fast-import --import-marks=marks.out <input && - git whatchanged verify--import-marks + git log --raw verify--import-marks ' test_expect_success 'A: verify pack' '@@ -652,7 +652,7 @@ test_expect_success 'C: incremental import create pack from stdin' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'C: verify pack' '@@ -715,7 +715,7 @@ test_expect_success 'D: inline data in commit' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'D: verify pack' '@@ -882,7 +882,7 @@ test_expect_success 'H: deletall, add 1' ' INPUT_END git fast-import <input && - git whatchanged H + git log --raw H ' test_expect_success 'H: verify pack' '@@ -2066,7 +2066,7 @@ test_expect_success 'Q: commit notes' ' INPUT_END git fast-import <input && - git whatchanged notes-test + git log --raw notes-test ' test_expect_success 'Q: verify pack' 't/t9301-fast-import-notes.sh +1
-2@@ -76,7 +76,7 @@ INPUT_END test_expect_success 'set up main branch' ' git fast-import <input && - git whatchanged main + git log --raw main ' commit4=$(git rev-parse refs/heads/main) --
Quoted 1 line
2.49.0-601-ga5925c3955
Looks good.
PATCH v3 4/6 whatchanged: require --i-still-use-this
In reply to Junio C HamanoThe documentation of "git whatchanged" is pretty explicit that this has retained for historical reasons to help those whose fingers cannot be retrained. Let's see if they still are finding it hard to type "git log --raw" instead of "git whatchanged" by marking the command as "nominated for removal", and require "--i-still-use-this" on the command line. Adjust the tests so that the option is passed when we invoke the command. In addition, we test that the command fails when "--i-still-use-this" is not given.
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
--- Documentation/git-whatchanged.adoc | 4 ++-- builtin/log.c | 13 +++++++++++++ t/t4013-diff-various.sh | 17 +++++++++++++++-- t/t4202-log.sh | 14 +++++++++----- 4 files changed, 39 insertions(+), 9 deletions(-)
Documentation/git-whatchanged.adoc +2 -2
@@ -8,8 +8,8 @@ git-whatchanged - Show logs with differences each commit introduces SYNOPSIS -------- -[verse] -'git whatchanged' <option>... +[synopsis] +git whatchanged <option>... DESCRIPTION -----------
builtin/log.c +13 -0
@@ -113,6 +113,13 @@ struct log_config {int fmt_patch_name_max;char *fmt_pretty;char *default_date_mode; + +/* +* 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; };static void log_config_init (struct log_config *cfg)
@@ -267,6 +274,8 @@ 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" )), +OPT_HIDDEN_BOOL (0 ,"i-still-use-this" , &cfg->i_still_use_this, +"<use this deprecated command>" ),OPT_ALIAS (0 ,"mailmap" ,"use-mailmap" ), OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL, N_("clear all previously-defined decoration filters"),
@@ -656,6 +665,10 @@ int cmd_whatchanged(int argc, opt.def ="HEAD" ; opt.revarg_opt =REVARG_COMMITTISH ;cmd_log_init (argc, argv, prefix, &rev, &opt, &cfg); + +if (!cfg.i_still_use_this) +you_still_use_that ("git whatchanged" ); +if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_RAW ;
t/t4013-diff-various.sh +15 -2
@@ -203,11 +203,19 @@ do test_expect_success "git $cmd # magic is ${magic:-(not used)}" ' { echo "$ git $cmd" + + case "$cmd" in + whatchanged | whatchanged" "*) + run="whatchanged --i-still-use-this" + run="$run ${cmd#whatchanged}" ;; + *) + run=$cmd ;; + esac && case "$magic" in "") - GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;; + GIT_PRINT_SHA1_ELLIPSIS=yes git $run ;; noellipses) - git $cmd ;; + git $run ;; esac | sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \ -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
@@ -454,6 +462,11 @@ 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_must_fail git whatchanged >message 2>&1 && + test_grep "nominated for removal" message +' + test_expect_success 'log -m matches pure log' ' git log master >result && process_diffs result >expected &&
t/t4202-log.sh +9 -5
@@ -490,6 +490,7 @@ for cmd in show whatchanged reflog format-patch do case "$cmd" in format-patch) myarg="HEAD~.." ;; + whatchanged) myarg=--i-still-use-this ;; *) myarg= ;; esac
@@ -1202,19 +1203,22 @@ test_expect_success 'reflog is expected format' ' ' test_expect_success 'whatchanged is expected format' ' + whatchanged="whatchanged --i-still-use-this" && git log --no-merges --raw >expect && - git whatchanged >actual && + git $whatchanged >actual && test_cmp expect actual ' test_expect_success 'log.abbrevCommit configuration' ' + whatchanged="whatchanged --i-still-use-this" && + git log --abbrev-commit >expect.log.abbrev && git log --no-abbrev-commit >expect.log.full && 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 && + git $whatchanged --abbrev-commit >expect.whatchanged.abbrev && + git $whatchanged --no-abbrev-commit >expect.whatchanged.full && test_config log.abbrevCommit true &&
@@ -1231,9 +1235,9 @@ test_expect_success 'log.abbrevCommit configuration' ' git reflog --no-abbrev-commit >actual && test_cmp expect.reflog.full actual && - git whatchanged >actual && + git $whatchanged >actual && test_cmp expect.whatchanged.abbrev actual && - git whatchanged --no-abbrev-commit >actual && + git $whatchanged --no-abbrev-commit >actual && test_cmp expect.whatchanged.full actual '
Signature · 1 line
2.49.0-601-ga5925c3955
Re: [PATCH v3 4/6] whatchanged: require --i-still-use-this
Quoted 2 lines · Junio C Hamano
The documentation of "git whatchanged" is pretty explicit that this has retained for historical reasons to help those whose fingers
I feel like there's a word missing here. Maybe "that this command has been retained"?
Quoted 9 lines
cannot be retrained. Let's see if they still are finding it hard to type "git log --raw" instead of "git whatchanged" by marking the command as "nominated for removal", and require "--i-still-use-this" on the command line. Adjust the tests so that the option is passed when we invoke the command. In addition, we test that the command fails when "--i-still-use-this" is not given.
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
This while-at-it change feels a bit funny given that we don't touch the docs at all, but I don't mind it too much.
Patrick
Re: [PATCH v3 4/6] whatchanged: require --i-still-use-this
Quoted 5 lines · Patrick Steinhardt
Quoted 2 lines
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
This while-at-it change feels a bit funny given that we don't touch the docs at all, but I don't mind it too much.
Yeah, that exactly was what I was thinking while rereading the patches. I think it may make a better organization to delay it till the very end where we do add new material to the file.
Thanks.
PATCH v3 5/6 whatchanged: remove when built with WITH_BREAKING_CHANGES
In reply to Junio C HamanoAs 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.
--- 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(-)
Documentation/config/format.adoc +6 -0
@@ -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
Documentation/config/log.adoc +9 -2
@@ -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::
Documentation/pretty-options.adoc +5 -0
@@ -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. +
Documentation/rev-list-options.adoc +7 -2
@@ -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[]
Documentation/technical/sparse-checkout.adoc +1 -1
@@ -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
builtin/log.c +6 -0
@@ -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_CHANGESOPT_HIDDEN_BOOL (0 ,"i-still-use-this" , &cfg->i_still_use_this,"<use this deprecated command>" ), +#endifOPT_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) {
git.c +2 -0
@@ -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 }, };
t/t4013-diff-various.sh +10 -2
@@ -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 '
t/t4202-log.sh +20 -8
@@ -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' '
Signature · 1 line
2.49.0-601-ga5925c3955
Re: [PATCH v3 5/6] whatchanged: remove when built with WITH_BREAKING_CHANGES
Quoted 11 lines · Junio C Hamano
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.
We'd also need to adjust Meson so that it doesn't install the documentation anymore. So something like the below (untested) patch.
Patrick
Documentation/Makefile +1 -1
@@ -510,7 +510,7 @@ lint-docs-meson: awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \ grep -v -e '#' -e '^$$' | \ sort >tmp-meson-diff/meson.adoc && \ - ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-pack-redundant.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \ + ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-pack-redundant.adoc -e git-whatchanged.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \ if ! cmp tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; then \ echo "Meson man pages differ from actual man pages:"; \ diff -u tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; \
Documentation/meson.build +1 -1
@@ -158,7 +158,6 @@ manpages = { 'git-verify-tag.adoc' : 1, 'git-version.adoc' : 1, 'git-web--browse.adoc' : 1, - 'git-whatchanged.adoc' : 1, 'git-worktree.adoc' : 1, 'git-write-tree.adoc' : 1, 'git.adoc' : 1,
@@ -207,6 +206,7 @@ manpages = { manpages_breaking_changes = { 'git-pack-redundant.adoc' : 1, + 'git-whatchanged.adoc' : 1, } if not get_option('breaking_changes')
Re: [PATCH v3 5/6] whatchanged: remove when built with WITH_BREAKING_CHANGES
Quoted 13 lines · Patrick Steinhardt
Quoted 11 lines · Junio C Hamano
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.
Quoted 2 lines
We'd also need to adjust Meson so that it doesn't install the documentation anymore. So something like the below (untested) patch.
Thanks.
Documentation/Makefile lint-docs-meson: · line 513
Quoted 10 lines
Documentation/Makefile +1
-1@@ -510,7 +510,7 @@ lint-docs-meson: awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \ grep -v -e '#' -e '^$$' | \ sort >tmp-meson-diff/meson.adoc && \ - ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-pack-redundant.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \ + ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-pack-redundant.adoc -e git-whatchanged.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \
Yuck.
Quoted 13 lines
Documentation/meson.build +0
-1@@ -158,7 +158,6 @@ manpages = { 'git-verify-tag.adoc' : 1, 'git-version.adoc' : 1, 'git-web--browse.adoc' : 1, - 'git-whatchanged.adoc' : 1, 'git-worktree.adoc' : 1, 'git-write-tree.adoc' : 1, 'git.adoc' : 1,
Documentation/meson.build manpages = { · line 210
Quoted 5 lines
Documentation/meson.build +1
-0@@ -207,6 +206,7 @@ manpages = { manpages_breaking_changes = { 'git-pack-redundant.adoc' : 1, + 'git-whatchanged.adoc' : 1, }
OK.
Thanks.
PATCH v3 6/6 whatschanged: list it in BreakingChanges document
In reply to Junio C HamanoThis can be squashed into the previous step. That is how our "git pack-redundant" conversion did.
Theoretically, however, those who want to gauge the need to keep the command by exposing their users to patches before this one may want to wait until their experiment finishes before they formally say "this will go away".
This change is made into a separate patch from the previous step precisely to help those folks.
--- Documentation/BreakingChanges.adoc | 9 +++++++++ Documentation/git-whatchanged.adoc | 6 ++++++ 2 files changed, 15 insertions(+)
Documentation/BreakingChanges.adoc +9 -0
@@ -178,6 +178,15 @@ references. + These features will be removed. +* The git-whatchanged(1) command has outlived its usefulness more than + 10 years ago, and takes more keystrokes to type than its rough + equivalent `git log --raw`. We have nominated the command for + removal, have changed the command to refuse to work unless the + `--i-still-use-this` option is given, and asked the users to report + when they do so. So far there hasn't been a single complaint. ++ +The command will be removed + == Superseded features that will not be deprecated Some features have gained newer replacements that aim to improve the design in
Documentation/git-whatchanged.adoc +6 -0
@@ -11,6 +11,12 @@ SYNOPSIS [synopsis] git whatchanged <option>... +WARNING +------- +`git whatchanged` has been deprecated and is scheduled for removal in +a future version of Git, as it is merely `git log` with different +default; `whatchanged` is not even shorter to type than `log --raw`. + DESCRIPTION -----------
Signature · 1 line
2.49.0-601-ga5925c3955
Re: [PATCH v3 6/6] whatschanged: list it in BreakingChanges document
Quoted 11 lines · Junio C Hamano
This can be squashed into the previous step. That is how our "git pack-redundant" conversion did.
Theoretically, however, those who want to gauge the need to keep the command by exposing their users to patches before this one may want to wait until their experiment finishes before they formally say "this will go away".
This change is made into a separate patch from the previous step precisely to help those folks.
Were these three paragraphs intended to come after the "---" line, but accidentally placed in the commit message?
Quoted 13 lines
Signed-off-by Junio C Hamano <[email protected]>--- Documentation/BreakingChanges.adoc | 9 +++++++++ Documentation/git-whatchanged.adoc | 6 ++++++ 2 files changed, 15 insertions(+)Documentation/BreakingChanges.adoc +0
-0@@ -178,6 +178,15 @@ references. +
Documentation/BreakingChanges.adoc references. · line 188
Quoted 10 lines
Documentation/BreakingChanges.adoc +8
-0These features will be removed. +* The git-whatchanged(1) command has outlived its usefulness more than + 10 years ago, and takes more keystrokes to type than its rough + equivalent `git log --raw`. We have nominated the command for + removal, have changed the command to refuse to work unless the + `--i-still-use-this` option is given, and asked the users to report + when they do so. So far there hasn't been a single complaint. ++ +The command will be removed
Missing period at the end of this sentence?
Quoted 23 lines
Documentation/BreakingChanges.adoc +1
-0+ == Superseded features that will not be deprecated Some features have gained newer replacements that aim to improve the design inDocumentation/git-whatchanged.adoc +6
-1@@ -11,6 +11,12 @@ SYNOPSIS [synopsis] git whatchanged <option>... +WARNING +------- +`git whatchanged` has been deprecated and is scheduled for removal in +a future version of Git, as it is merely `git log` with different +default; `whatchanged` is not even shorter to type than `log --raw`. + DESCRIPTION ----------- --2.49.0-601-ga5925c3955
Re: [PATCH v3 6/6] whatschanged: list it in BreakingChanges document
Quoted 10 lines · Elijah Newren
Quoted 9 lines · Junio C Hamano
This can be squashed into the previous step. That is how our "git pack-redundant" conversion did.
Theoretically, however, those who want to gauge the need to keep the command by exposing their users to patches before this one may want to wait until their experiment finishes before they formally say "this will go away".
Quoted 5 lines
Quoted 2 lines
This change is made into a separate patch from the previous step precisely to help those folks.
Were these three paragraphs intended to come after the "---" line, but accidentally placed in the commit message?
They are indeed meant above the "---" line to explain why this one is separate.
Quoted 10 lines
Documentation/BreakingChanges.adoc references. · line 188
Quoted 8 lines
Documentation/BreakingChanges.adoc +8
-0+* The git-whatchanged(1) command has outlived its usefulness more than + 10 years ago, and takes more keystrokes to type than its rough + equivalent `git log --raw`. We have nominated the command for + removal, have changed the command to refuse to work unless the + `--i-still-use-this` option is given, and asked the users to report + when they do so. So far there hasn't been a single complaint. ++ +The command will be removedMissing period at the end of this sentence?
Indeed.
Thanks.
v4 cover Nominating "whatchanged" for removal
In reply to Junio C Hamano"git whatchanged" has outlived its usefulness when "git log" with various diff-related options more than 10 years ago. It is not even shorter to type than its rough equivalent "git log --raw". It is high time to start seeing if it is still being used, declare its official deprecation, and announce its removal in the future.
This iteration is more complete than the previous two iterations:
* The first step is to refactor the mechanism to show the message to ask users to contact git@vger that they still use the command, out of "git pack-redundant" implementation. This message is shown when the "--i-still-use-this" option is not passed to a command that requires it.
* The second and the third step are to remove unnecessary mentions of "whatchanged" from our documentation and tests. With these, we have fewer places that we need to adjust when the command gets truly removed.
* Then we start to require that the "--i-still-use-this" option is passed from the command line. This requires adjustment for tests that protect the behaviour of the command, as they must now pass the required option just like end-users.
* The last two steps are for a future. In order to make sure that we can cleanly ditch the feature at some future date by removing it from the build, test, and documentation when Git is built with WITH_BREAKING_CHANGES. And finally we add "whatchanged" to the list of features to be removed in the BreakingChanges document.
This iteration incorporates updated log messages, and a missing period in the documentation, helped by Elijah.
Junio C Hamano (6):
you-still-use-that??: help deprecating commands for removal
doc: prepare for a world without whatchanged
tests: prepare for a world without whatchanged
whatchanged: require --i-still-use-this
whatchanged: remove when built with WITH_BREAKING_CHANGES
whatschanged: list it in BreakingChanges document
Documentation/BreakingChanges.adoc | 9 ++++++ Documentation/MyFirstObjectWalk.adoc | 4 +-- Documentation/config/format.adoc | 6 ++++ Documentation/config/log.adoc | 11 +++++-- Documentation/git-whatchanged.adoc | 10 ++++-- Documentation/pretty-options.adoc | 5 +++ Documentation/rev-list-options.adoc | 9 ++++-- Documentation/technical/sparse-checkout.adoc | 2 +- Documentation/user-manual.adoc | 2 +- builtin/log.c | 19 +++++++++++ builtin/pack-redundant.c | 10 ++---- git-compat-util.h | 2 ++ git.c | 2 ++ t/t4013-diff-various.sh | 27 ++++++++++++++-- t/t4202-log.sh | 34 ++++++++++++++------ t/t5323-pack-redundant.sh | 5 +++ t/t9300-fast-import.sh | 12 +++---- t/t9301-fast-import-notes.sh | 2 +- usage.c | 12 +++++++ 19 files changed, 146 insertions(+), 37 deletions(-)
Range-diff against v3:
1: a43a2ffdab ! 1: fedbc30d0e you-still-use-that??: help deprecating commands for removal
@@ Metadata
## Commit message ##
you-still-use-that??: help deprecating commands for removal
- A command slated for removal like "git pack-redundant" gains a
- command line option "--i-still-use-this", and refuses to work when
- the option is not given. The message and the instruction upon
- seeing what to do are both rather long, so before letting another
- command to use the same mechanism, factor out the message+die part
- into a small helper function, and use that.
+ Commands slated for removal like "git pack-redundant" now require
+ an explicit "--i-still-use-this" option to run. This is to
+ discourage casual use and surface their pending deprecation to
+ users.
- The existing pack-redundant test lacked a test to make sure that we
- require the --i-still-use-this option. Add one while we are at it.
+ The warning message is long, so factor it into a helper function
+ you_still_use_that() to simplify reuse by other commands.
+
+ Also add a missing test to ensure this enforcement works for
+ "pack-redundant".
2: 16ccf7d92e ! 2: 7a3897acca doc: prepare for a world without whatchanged
@@ Metadata
## Commit message ##
doc: prepare for a world without whatchanged
- These documents mention "whatchanged" as an example, that can be
- substituted by something else. A new hypothetical command "walken"
- would come near "whatchanged" but since the latter may be going
- away, we can say it would come near "version", as the fictitious
- command sorts between them. Similarly, we do not have to use
- "whatchanged" as an example of a subcommand that is also implemented
- in builtin/log.c file; we can instead mention "show".
-
- Both of these changes allow us not to worry about adjusting these
- places when "whatchanged" is finally removed.
+ Some documentation examples reference "whatchanged", either as a
+ placeholder command or an example of source structure.
+
+ To reduce the need for future edits when whatchanged is removed,
+ replace these references with alternatives:
+
+ - In MyFirstObjectWalk.adoc, use version as the nearby anchor
+ point for walken, instead of whatchanged.
+
+ - In user-manual.adoc, cite show instead of whatchanged as
+ a command whose source lives in the same file as log.
3: 6951fb8cef ! 3: f696eed84b tests: prepare for a world without whatchanged
@@ Commit message
Some tests on fast-import run "git whatchanged" without even checking the output from the command. It is tempting to remove the calls altogether since they are not doing anything useful, but they
- presumably were placed while the tests were developed to manually
+ presumably were added there while the tests were developed to manually
sanity check which paths were touched.
Replace these calls with "git log --raw", which is a rough
4: 2775f628c3 = 4: 01d4ed9acd whatchanged: require --i-still-use-this 5: b3d4d1f46a = 5: a7aca55d5d whatchanged: remove when built with WITH_BREAKING_CHANGES 6: 7c89054731 ! 6: 9d60f38d2f whatschanged: list it in BreakingChanges document
@@ Documentation/BreakingChanges.adoc: references.
+ --i-still-use-this option is given, and asked the users to report
+ when they do so. So far there hasn't been a single complaint. ++
-+The command will be removed
++The command will be removed.
+
== Superseded features that will not be deprecated
Signature · 1 line
2.49.0-674-gc1e4f99c0b
PATCH v4 1/6 you-still-use-that??: help deprecating commands for removal
Commands slated for removal like "git pack-redundant" now require an explicit "--i-still-use-this" option to run. This is to discourage casual use and surface their pending deprecation to users.
The warning message is long, so factor it into a helper function you_still_use_that() to simplify reuse by other commands.
Also add a missing test to ensure this enforcement works for "pack-redundant".
--- builtin/pack-redundant.c | 10 ++-------- git-compat-util.h | 2 ++ t/t5323-pack-redundant.sh | 5 +++++ usage.c | 12 ++++++++++++ 4 files changed, 21 insertions(+), 8 deletions(-)
builtin/pack-redundant.c +2 -8
@@ -625,14 +625,8 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, sbreak ; } -if (!i_still_use_this) { -fputs (_ ("'git pack-redundant' is nominated for removal.\n" -"If you still use this command, please add an extra\n" -"option, '--i-still-use-this', on the command line\n" -"and let us know you still use it by sending an e-mail\n" -"to <[email protected]>. Thanks.\n" ), stderr); -die (_ ("refusing to run without --i-still-use-this" )); - } +if (!i_still_use_this) +you_still_use_that ("git pack-redundant" );if (load_all_packs)load_all ();
git-compat-util.h +2 -0
@@ -703,6 +703,8 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));void show_usage_if_asked (int ac,const char **av,const char *err); +NORETURN void you_still_use_that(const char *command_name); +#ifndef NO_OPENSSL #ifdef APPLE_COMMON_CRYPTO #include "compat/apple-common-crypto.h"
t/t5323-pack-redundant.sh +5 -0
@@ -45,6 +45,11 @@ fi main_repo=main.git shared_repo=shared.git +test_expect_success 'pack-redundant needs --i-still-use-this' ' + test_must_fail git pack-redundant >message 2>&1 && + test_grep "nominated for removal" message +' + git_pack_redundant='git pack-redundant --i-still-use-this' # Create commits in <repo> and assign each commit's oid to shell variables
usage.c +12 -0
@@ -372,3 +372,15 @@ void bug_fl(const char *file, int line, const char *fmt, ...)trace2_cmd_error_va (fmt, ap);va_end (ap); } + +NORETURN void you_still_use_that(const char *command_name) +{ +fprintf (stderr, +_ ("'%s' is nominated for removal.\n" +"If you still use this command, please add an extra\n" +"option, '--i-still-use-this', on the command line\n" +"and let us know you still use it by sending an e-mail\n" +"to <[email protected]>. Thanks.\n" ), + command_name); +die (_ ("refusing to run without --i-still-use-this" )); +}
Signature · 1 line
2.49.0-674-gc1e4f99c0b
PATCH v4 2/6 doc: prepare for a world without whatchanged
In reply to Junio C HamanoSome documentation examples reference "whatchanged", either as a placeholder command or an example of source structure.
To reduce the need for future edits when whatchanged is removed, replace these references with alternatives:
- In MyFirstObjectWalk.adoc, use version as the nearby anchor point for walken, instead of whatchanged.
- In user-manual.adoc, cite show instead of whatchanged as a command whose source lives in the same file as log.
--- Documentation/MyFirstObjectWalk.adoc | 4 ++-- Documentation/user-manual.adoc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Documentation/MyFirstObjectWalk.adoc +2 -2
@@ -83,13 +83,13 @@ int cmd_walken(int argc, const char **argv, const char *prefix) } ---- -Also add the relevant line in `builtin.h` near `cmd_whatchanged()`: +Also add the relevant line in `builtin.h` near `cmd_version()`: ---- int cmd_walken(int argc, const char **argv, const char *prefix); ---- -Include the command in `git.c` in `commands[]` near the entry for `whatchanged`, +Include the command in `git.c` in `commands[]` near the entry for `version`, maintaining alphabetical ordering: ----
Documentation/user-manual.adoc +1 -1
@@ -4240,7 +4240,7 @@ command `git`. The source side of a builtin is - an entry in `BUILTIN_OBJECTS` in the `Makefile`. Sometimes, more than one builtin is contained in one source file. For -example, `cmd_whatchanged()` and `cmd_log()` both reside in `builtin/log.c`, +example, `cmd_show()` and `cmd_log()` both reside in `builtin/log.c`, since they share quite a bit of code. In that case, the commands which are _not_ named like the `.c` file in which they live have to be listed in `BUILT_INS` in the `Makefile`.
Signature · 1 line
2.49.0-674-gc1e4f99c0b
PATCH v4 3/6 tests: prepare for a world without whatchanged
In reply to Junio C HamanoSome tests on fast-import run "git whatchanged" without even checking the output from the command. It is tempting to remove the calls altogether since they are not doing anything useful, but they presumably were added there while the tests were developed to manually sanity check which paths were touched.
Replace these calls with "git log --raw", which is a rough equivalent in the more modern Git.
This does not remove "git whatchanged", but we no longer have to worry about adjusting these places when we eventually do.
--- t/t9300-fast-import.sh | 12 ++++++------ t/t9301-fast-import-notes.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
t/t9300-fast-import.sh +6 -6
@@ -120,7 +120,7 @@ test_expect_success 'A: create pack from stdin' ' INPUT_END git fast-import --export-marks=marks.out <input && - git whatchanged main + git log --raw main ' test_expect_success 'A: verify pack' '
@@ -279,7 +279,7 @@ test_expect_success 'A: verify marks import does not crash' ' INPUT_END git fast-import --import-marks=marks.out <input && - git whatchanged verify--import-marks + git log --raw verify--import-marks ' test_expect_success 'A: verify pack' '
@@ -652,7 +652,7 @@ test_expect_success 'C: incremental import create pack from stdin' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'C: verify pack' '
@@ -715,7 +715,7 @@ test_expect_success 'D: inline data in commit' ' INPUT_END git fast-import <input && - git whatchanged branch + git log --raw branch ' test_expect_success 'D: verify pack' '
@@ -882,7 +882,7 @@ test_expect_success 'H: deletall, add 1' ' INPUT_END git fast-import <input && - git whatchanged H + git log --raw H ' test_expect_success 'H: verify pack' '
@@ -2066,7 +2066,7 @@ test_expect_success 'Q: commit notes' ' INPUT_END git fast-import <input && - git whatchanged notes-test + git log --raw notes-test ' test_expect_success 'Q: verify pack' '
t/t9301-fast-import-notes.sh +1 -1
@@ -76,7 +76,7 @@ INPUT_END test_expect_success 'set up main branch' ' git fast-import <input && - git whatchanged main + git log --raw main ' commit4=$(git rev-parse refs/heads/main)
Signature · 1 line
2.49.0-674-gc1e4f99c0b
PATCH v4 4/6 whatchanged: require --i-still-use-this
In reply to Junio C HamanoThe documentation of "git whatchanged" is pretty explicit that this has retained for historical reasons to help those whose fingers cannot be retrained. Let's see if they still are finding it hard to type "git log --raw" instead of "git whatchanged" by marking the command as "nominated for removal", and require "--i-still-use-this" on the command line. Adjust the tests so that the option is passed when we invoke the command. In addition, we test that the command fails when "--i-still-use-this" is not given.
--- builtin/log.c | 13 +++++++++++++ t/t4013-diff-various.sh | 17 +++++++++++++++-- t/t4202-log.sh | 14 +++++++++----- 3 files changed, 37 insertions(+), 7 deletions(-)
builtin/log.c +13 -0
@@ -113,6 +113,13 @@ struct log_config {int fmt_patch_name_max;char *fmt_pretty;char *default_date_mode; + +/* +* 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; };static void log_config_init (struct log_config *cfg)
@@ -267,6 +274,8 @@ 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" )), +OPT_HIDDEN_BOOL (0 ,"i-still-use-this" , &cfg->i_still_use_this, +"<use this deprecated command>" ),OPT_ALIAS (0 ,"mailmap" ,"use-mailmap" ), OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL, N_("clear all previously-defined decoration filters"),
@@ -656,6 +665,10 @@ int cmd_whatchanged(int argc, opt.def ="HEAD" ; opt.revarg_opt =REVARG_COMMITTISH ;cmd_log_init (argc, argv, prefix, &rev, &opt, &cfg); + +if (!cfg.i_still_use_this) +you_still_use_that ("git whatchanged" ); +if (!rev.diffopt.output_format) rev.diffopt.output_format =DIFF_FORMAT_RAW ;
t/t4013-diff-various.sh +15 -2
@@ -203,11 +203,19 @@ do test_expect_success "git $cmd # magic is ${magic:-(not used)}" ' { echo "$ git $cmd" + + case "$cmd" in + whatchanged | whatchanged" "*) + run="whatchanged --i-still-use-this" + run="$run ${cmd#whatchanged}" ;; + *) + run=$cmd ;; + esac && case "$magic" in "") - GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;; + GIT_PRINT_SHA1_ELLIPSIS=yes git $run ;; noellipses) - git $cmd ;; + git $run ;; esac | sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \ -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
@@ -454,6 +462,11 @@ 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_must_fail git whatchanged >message 2>&1 && + test_grep "nominated for removal" message +' + test_expect_success 'log -m matches pure log' ' git log master >result && process_diffs result >expected &&
t/t4202-log.sh +9 -5
@@ -490,6 +490,7 @@ for cmd in show whatchanged reflog format-patch do case "$cmd" in format-patch) myarg="HEAD~.." ;; + whatchanged) myarg=--i-still-use-this ;; *) myarg= ;; esac
@@ -1202,19 +1203,22 @@ test_expect_success 'reflog is expected format' ' ' test_expect_success 'whatchanged is expected format' ' + whatchanged="whatchanged --i-still-use-this" && git log --no-merges --raw >expect && - git whatchanged >actual && + git $whatchanged >actual && test_cmp expect actual ' test_expect_success 'log.abbrevCommit configuration' ' + whatchanged="whatchanged --i-still-use-this" && + git log --abbrev-commit >expect.log.abbrev && git log --no-abbrev-commit >expect.log.full && 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 && + git $whatchanged --abbrev-commit >expect.whatchanged.abbrev && + git $whatchanged --no-abbrev-commit >expect.whatchanged.full && test_config log.abbrevCommit true &&
@@ -1231,9 +1235,9 @@ test_expect_success 'log.abbrevCommit configuration' ' git reflog --no-abbrev-commit >actual && test_cmp expect.reflog.full actual && - git whatchanged >actual && + git $whatchanged >actual && test_cmp expect.whatchanged.abbrev actual && - git whatchanged --no-abbrev-commit >actual && + git $whatchanged --no-abbrev-commit >actual && test_cmp expect.whatchanged.full actual '
Signature · 1 line
2.49.0-674-gc1e4f99c0b
Re: [PATCH v4 4/6] whatchanged: require --i-still-use-this
Quoted 2 lines · Junio C Hamano
The documentation of "git whatchanged" is pretty explicit that this has retained for historical reasons to help those whose fingers
In 731a2c7d (whatchanged: require --i-still-use-this, 2025-05-12), the above has been rephrased to
The documentation of "git whatchanged" is pretty explicit that the command was retained for historical reasons to help those whose fingers
I won't repost the whole series, though.
Thanks.
PATCH v4 5/6 whatchanged: remove when built with WITH_BREAKING_CHANGES
In reply to Junio C HamanoAs 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.
--- 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(-)
Documentation/config/format.adoc +6 -0
@@ -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
Documentation/config/log.adoc +9 -2
@@ -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::
Documentation/pretty-options.adoc +5 -0
@@ -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. +
Documentation/rev-list-options.adoc +7 -2
@@ -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[]
Documentation/technical/sparse-checkout.adoc +1 -1
@@ -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
builtin/log.c +6 -0
@@ -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_CHANGESOPT_HIDDEN_BOOL (0 ,"i-still-use-this" , &cfg->i_still_use_this,"<use this deprecated command>" ), +#endifOPT_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) {
git.c +2 -0
@@ -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 }, };
t/t4013-diff-various.sh +10 -2
@@ -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 '
t/t4202-log.sh +20 -8
@@ -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' '
Signature · 1 line
2.49.0-674-gc1e4f99c0b
PATCH v4 6/6 whatschanged: list it in BreakingChanges document
In reply to Junio C HamanoThis can be squashed into the previous step. That is how our "git pack-redundant" conversion did.
Theoretically, however, those who want to gauge the need to keep the command by exposing their users to patches before this one may want to wait until their experiment finishes before they formally say "this will go away".
This change is made into a separate patch from the previous step precisely to help those folks.
While at it, update the documentation page to use the new [synopsis] facility to mark-up the SYNOPSIS part.
--- Documentation/BreakingChanges.adoc | 9 +++++++++ Documentation/git-whatchanged.adoc | 10 ++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
Documentation/BreakingChanges.adoc +9 -0
@@ -178,6 +178,15 @@ references. + These features will be removed. +* The git-whatchanged(1) command has outlived its usefulness more than + 10 years ago, and takes more keystrokes to type than its rough + equivalent `git log --raw`. We have nominated the command for + removal, have changed the command to refuse to work unless the + `--i-still-use-this` option is given, and asked the users to report + when they do so. So far there hasn't been a single complaint. ++ +The command will be removed. + == Superseded features that will not be deprecated Some features have gained newer replacements that aim to improve the design in
Documentation/git-whatchanged.adoc +8 -2
@@ -8,8 +8,14 @@ git-whatchanged - Show logs with differences each commit introduces SYNOPSIS -------- -[verse] -'git whatchanged' <option>... +[synopsis] +git whatchanged <option>... + +WARNING +------- +`git whatchanged` has been deprecated and is scheduled for removal in +a future version of Git, as it is merely `git log` with different +default; `whatchanged` is not even shorter to type than `log --raw`. DESCRIPTION -----------
Signature · 1 line
2.49.0-674-gc1e4f99c0b
Quoted 64 lines · Junio C Hamano
"git whatchanged" has outlived its usefulness when "git log" with various diff-related options more than 10 years ago. It is not even shorter to type than its rough equivalent "git log --raw". It is high time to start seeing if it is still being used, declare its official deprecation, and announce its removal in the future.
This iteration is more complete than the previous two iterations:
* The first step is to refactor the mechanism to show the message to ask users to contact git@vger that they still use the command, out of "git pack-redundant" implementation. This message is shown when the "--i-still-use-this" option is not passed to a command that requires it.
* The second and the third step are to remove unnecessary mentions of "whatchanged" from our documentation and tests. With these, we have fewer places that we need to adjust when the command gets truly removed.
* Then we start to require that the "--i-still-use-this" option is passed from the command line. This requires adjustment for tests that protect the behaviour of the command, as they must now pass the required option just like end-users.
* The last two steps are for a future. In order to make sure that we can cleanly ditch the feature at some future date by removing it from the build, test, and documentation when Git is built with
WITH_BREAKING_CHANGES. And finally we add "whatchanged" to the list of features to be removed in the BreakingChanges document.This iteration incorporates updated log messages, and a missing period in the documentation, helped by Elijah.
Junio C Hamano (6):
you-still-use-that??: help deprecating commands for removal
doc: prepare for a world without whatchanged
tests: prepare for a world without whatchanged
whatchanged: require --i-still-use-this
whatchanged: remove when built withWITH_BREAKING_CHANGES
whatschanged: list it in BreakingChanges documentDocumentation/BreakingChanges.adoc | 9 ++++++ Documentation/MyFirstObjectWalk.adoc | 4 +-- Documentation/config/format.adoc | 6 ++++ Documentation/config/log.adoc | 11 +++++-- Documentation/git-whatchanged.adoc | 10 ++++-- Documentation/pretty-options.adoc | 5 +++ Documentation/rev-list-options.adoc | 9 ++++-- Documentation/technical/sparse-checkout.adoc | 2 +- Documentation/user-manual.adoc | 2 +- builtin/log.c | 19 +++++++++++ builtin/pack-redundant.c | 10 ++---- git-compat-util.h | 2 ++ git.c | 2 ++ t/t4013-diff-various.sh | 27 ++++++++++++++-- t/t4202-log.sh | 34 ++++++++++++++------ t/t5323-pack-redundant.sh | 5 +++ t/t9300-fast-import.sh | 12 +++---- t/t9301-fast-import-notes.sh | 2 +- usage.c | 12 +++++++ 19 files changed, 146 insertions(+), 37 deletions(-)
Quoted 1 line
Range-diff against v3:
The updates to patches 1-3 and patch 6 all look good, but...
Quoted 2 lines
4: 2775f628c3 = 4: 01d4ed9acd whatchanged: require --i-still-use-this 5: b3d4d1f46a = 5: a7aca55d5d whatchanged: remove when built with WITH_BREAKING_CHANGES
...I was surprised to see no changes to either patches 4 or 5. While I didn't comment on those patches myself, Patrick did (and since he already called out the missing word I also noticed, I just didn't call it out again).
Quoted 9 lines · Elijah Newren
The updates to patches 1-3 and patch 6 all look good, but...
Quoted 2 lines
4: 2775f628c3 = 4: 01d4ed9acd whatchanged: require --i-still-use-this 5: b3d4d1f46a = 5: a7aca55d5d whatchanged: remove when built with WITH_BREAKING_CHANGES...I was surprised to see no changes to either patches 4 or 5. While I didn't comment on those patches myself, Patrick did (and since he already called out the missing word I also noticed, I just didn't call it out again).
The meson stuff did not exist in the codebase the topic was based on, so it won't be squashed into any of these individual patches, but if you take a look at
$ git show seen^{/^Merge.branch..jc/you-still}using any of the recent tip of 'seen', you'll see these changes applied as an evil merge to adjust the topic to an updated meson machinery in the more recent codebase.
For other changes, "developped" was already fixed, but "the command was retained" was missed, so I'll locally amend.
Thanks.