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

[PATCH v2 1/2] you-still-use-that??: help deprecating commands for removal

From
Junio C Hamano <gitster@pobox.com>
Date
May 1, 2025, 22:59 UTC
Message-ID
<20250501225958.2947677-2-gitster@pobox.com>
In-Reply-To
<20250501225958.2947677-1-gitster@pobox.com>

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.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 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(-)
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index 3febe732f8..6dc9e020c7 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -625,14 +625,8 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, s
 			break;
 	}
 
-	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 <git@vger.kernel.org>.  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();
diff --git a/git-compat-util.h b/git-compat-util.h
index e123288e8f..21cab99567 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -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"
diff --git a/t/t5323-pack-redundant.sh b/t/t5323-pack-redundant.sh
index 688cd9706c..f2f20cfa40 100755
--- a/t/t5323-pack-redundant.sh
+++ b/t/t5323-pack-redundant.sh
@@ -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
diff --git a/usage.c b/usage.c
index 38b46bbbfe..4aaad2b553 100644
--- a/usage.c
+++ b/usage.c
@@ -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 <git@vger.kernel.org>.  Thanks.\n"),
+		command_name);
+	die(_("refusing to run without --i-still-use-this"));
+}
-- 
2.49.0-599-gc9a5c860a0
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 39 in “Nominating "whatchanged" for removal”
  1. 0/2 Nominating "whatchanged" for removalJunio C Hamano, May 1, 2025
  2. 1/2 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 1, 2025
  3. 2/2 whatchanged: require --i-still-use-thisJunio C Hamano, May 1, 2025
  4. Junio C HamanoMay 1, 2025
  5. 0/2 Nominating "whatchanged" for removalJunio C Hamano, May 1, 2025
  6. 1/2 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 1, 2025
  7. 2/2 whatchanged: require --i-still-use-thisJunio C Hamano, May 1, 2025
  8. Patrick SteinhardtMay 2, 2025
  9. Junio C HamanoMay 2, 2025
  10. Patrick SteinhardtMay 5, 2025
  11. Patrick SteinhardtMay 2, 2025
  12. Junio C HamanoMay 2, 2025
  13. 0/6 Nominating "whatchanged" for removalJunio C Hamano, May 3, 2025
  14. 1/6 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 3, 2025
  15. Elijah NewrenMay 12, 2025
  16. 2/6 doc: prepare for a world without whatchangedJunio C Hamano, May 3, 2025
  17. Elijah NewrenMay 12, 2025
  18. 3/6 tests: prepare for a world without whatchangedJunio C Hamano, May 3, 2025
  19. Patrick SteinhardtMay 5, 2025
  20. Elijah NewrenMay 12, 2025
  21. 4/6 whatchanged: require --i-still-use-thisJunio C Hamano, May 3, 2025
  22. Patrick SteinhardtMay 5, 2025
  23. Junio C HamanoMay 5, 2025
  24. 5/6 whatchanged: remove when built with WITH_BREAKING_CHANGESJunio C Hamano, May 3, 2025
  25. Patrick SteinhardtMay 5, 2025
  26. Junio C HamanoMay 5, 2025
  27. 6/6 whatschanged: list it in BreakingChanges documentJunio C Hamano, May 3, 2025
  28. Elijah NewrenMay 12, 2025
  29. Junio C HamanoMay 12, 2025
  30. 0/6 Nominating "whatchanged" for removalJunio C Hamano, May 12, 2025
  31. 1/6 you-still-use-that??: help deprecating commands for removalJunio C Hamano, May 12, 2025
  32. 2/6 doc: prepare for a world without whatchangedJunio C Hamano, May 12, 2025
  33. 3/6 tests: prepare for a world without whatchangedJunio C Hamano, May 12, 2025
  34. 4/6 whatchanged: require --i-still-use-thisJunio C Hamano, May 12, 2025
  35. Junio C HamanoMay 14, 2025
  36. 5/6 whatchanged: remove when built with WITH_BREAKING_CHANGESJunio C Hamano, May 12, 2025
  37. 6/6 whatschanged: list it in BreakingChanges documentJunio C Hamano, May 12, 2025
  38. Elijah NewrenMay 12, 2025
  39. Junio C HamanoMay 12, 2025

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

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