From: Siddharth Shrimali <r.siddharth.shrimali@gmail•com>
To: git@vger•kernel.org
Cc: gitster@pobox•com, ps@pks•im, stolee@gmail•com,
r.siddharth.shrimali@gmail•com
Subject: [PATCH] backfill: handle unexpected arguments
Date: Sat, 21 Mar 2026 08:46:43 +0530 [thread overview]
Message-ID: <20260321031643.5185-1-r.siddharth.shrimali@gmail.com> (raw)
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
next reply other threads:[~2026-03-21 3:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 3:16 Siddharth Shrimali [this message]
2026-03-21 4:42 ` [PATCH] backfill: handle unexpected arguments 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260321031643.5185-1-r.siddharth.shrimali@gmail.com \
--to=r.siddharth.shrimali@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=ps@pks$(echo .)im \
--cc=stolee@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox