path: root/builtin/stash.c
diff options
authorÆvar Arnfjörð Bjarmason <>2021-12-28 13:28:43 (GMT)
committerJunio C Hamano <>2021-12-30 21:05:28 (GMT)
commitfa476be8f0963d4dd512eaf8ee23b3cd3986a500 (patch)
tree07cc46c2a071ee0f0b4354920494227054af0666 /builtin/stash.c
parent68c69f90c8e98b305d9effd1d25f6261a30b8e50 (diff)
parse-options API: add a usage_msg_optf()
Add a usage_msg_optf() as a shorthand for the sort of usage_msg_opt(xstrfmt(...)) used in builtin/stash.c. I'll make more use of this function in builtin/cat-file.c shortly. The disconnect between the "..." and "fmt" is a bit unusual, but it works just fine and this keeps it consistent with usage_msg_opt(), i.e. a caller of it can be moved to usage_msg_optf() and not have to have its arguments re-arranged. Signed-off-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/stash.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/stash.c b/builtin/stash.c
index 18c812b..c9a0904 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1811,8 +1811,8 @@ int cmd_stash(int argc, const char **argv, const char *prefix)
else if (!strcmp(argv[0], "save"))
return !!save_stash(argc, argv, prefix);
else if (*argv[0] != '-')
- usage_msg_opt(xstrfmt(_("unknown subcommand: %s"), argv[0]),
- git_stash_usage, options);
+ usage_msg_optf(_("unknown subcommand: %s"),
+ git_stash_usage, options, argv[0]);
/* Assume 'stash push' */
strvec_push(&args, "push");