diff mbox series

[GSoC,RFC,2/6] builtin/log: die if -k and --suject-extra-prefix are used together

Message ID 20250303220029.10716-3-lucasseikioshiro@gmail.com (mailing list archive)
State New
Headers show
Series Add --subject-extra-prefix flag to format-patch | expand

Commit Message

Lucas Seiki Oshiro March 3, 2025, 10 p.m. UTC
When calling format-patch, -k keeps the commit title as the patch subject
and can't be used with other options that depend on the existence of a
prefix. This way, -k shouldn't also be used with --subject-extra-prefix,
as it introduces an extra prefix.

If -k and --subject-extra-prefix are used together, die.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
---
 builtin/log.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Eric Sunshine March 3, 2025, 10:36 p.m. UTC | #1
On Mon, Mar 3, 2025 at 5:01 PM Lucas Seiki Oshiro
<lucasseikioshiro@gmail.com> wrote:
> builtin/log: die if -k and --suject-extra-prefix are used together

s/suject/subject/

> When calling format-patch, -k keeps the commit title as the patch subject
> and can't be used with other options that depend on the existence of a
> prefix. This way, -k shouldn't also be used with --subject-extra-prefix,
> as it introduces an extra prefix.
>
> If -k and --subject-extra-prefix are used together, die.
>
> Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
diff mbox series

Patch

diff --git a/builtin/log.c b/builtin/log.c
index 95667c93ca..52dc0301cf 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -2256,6 +2256,8 @@  int cmd_format_patch(int argc,
 		die(_("options '%s' and '%s' cannot be used together"), "-n", "-k");
 	if (cfg.keep_subject && cfg.subject_prefix)
 		die(_("options '%s' and '%s' cannot be used together"), "--subject-prefix/--rfc", "-k");
+	if (cfg.keep_subject && extra_prefix)
+		die(_("options '%s' and '%s' cannot be used together"), "--subject-extra-prefix", "-k");
 	rev.preserve_subject = cfg.keep_subject;
 
 	argc = setup_revisions(argc, argv, &rev, &s_r_opt);