public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] backfill: handle unexpected arguments
@ 2026-03-21  3:16 Siddharth Shrimali
  2026-03-21  4:42 ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Siddharth Shrimali @ 2026-03-21  3:16 UTC (permalink / raw)
  To: git; +Cc: gitster, ps, stolee, r.siddharth.shrimali

git backfill takes no non-option arguments. However, if extra
arguments are passed with git backfill, parse_options() leaves
them in argc and the command currently ignores them silently,
giving the user no indication that something is wrong.

Add a check after parse_options() to call usage_with_options()
if any unexpected arguments remain. This prints the correct usage
and exits with an error, consistent with how other Git commands
such as git-gc and git-repack handle this situation.

Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
---
 builtin/backfill.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/builtin/backfill.c b/builtin/backfill.c
index e9a33e81be..0eb171478a 100644
--- a/builtin/backfill.c
+++ b/builtin/backfill.c
@@ -135,6 +135,9 @@ int cmd_backfill(int argc, const char **argv, const char *prefix, struct reposit
 
 	argc = parse_options(argc, argv, prefix, options, builtin_backfill_usage,
 			     0);
+	
+	if (argc)
+		usage_with_options(builtin_backfill_usage, options);
 
 	repo_config(repo, git_default_config, NULL);
 
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-03-23  6:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-21  3:16 [PATCH] backfill: handle unexpected arguments Siddharth Shrimali
2026-03-21  4:42 ` Junio C Hamano
2026-03-21  5:03   ` Junio C Hamano
2026-03-21 17:47     ` [PATCH v2] " Siddharth Shrimali
2026-03-22  1:13       ` Junio C Hamano
2026-03-22  5:32         ` [PATCH v3] " Siddharth Shrimali
2026-03-22 16:38           ` Phillip Wood
2026-03-22 18:06             ` Junio C Hamano
2026-03-22 23:01           ` Derrick Stolee
2026-03-23  1:01             ` Junio C Hamano
2026-03-23  1:42               ` Derrick Stolee
2026-03-23  6:17                 ` Siddharth Shrimali

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox