From: Junio C Hamano <gitster@pobox.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: <git@vger.kernel.org>, Jacob Keller <jacob.keller@gmail.com>,
"Konstantin Ryabitsev" <konstantin@linuxfoundation.org>
Subject: Re: [PATCH 3/3] send-email: teach git send-email option to translate aliases
Date: Fri, 09 Aug 2024 14:05:59 -0700 [thread overview]
Message-ID: <xmqqplqhbe4o.fsf@gitster.g> (raw)
In-Reply-To: <5ad39a07-a2d4-45d2-9b5d-0180cb903801@intel.com> (Jacob Keller's message of "Fri, 9 Aug 2024 12:51:45 -0700")
Jacob Keller <jacob.e.keller@intel.com> writes:
> We could try to implement scanning for options ourselves, but I wouldn't
> want to break things like "--" to make it treat potential option-looking
> fields as aliases...
The appoach --dump-aliases takes is already broken with respect to
options that take or do not take an argument, if you really want to
scan, understand, and skip irrelevant options anyway, no? The
separate, trimmed down %dump_aliases_options map cannot help you to
tell from the command line "git cmd --translate --foo bar" if
skipping just "--foo" gives you the alias-to-be-expanded "bar", or
"--foo" takes an argument that is "bar" and there is no alias left.
So I do not quite know how involved you want to go, but naïvely, I
would have thought something along the lines of illustration below
is sufficient.
git-send-email.perl | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git c/git-send-email.perl w/git-send-email.perl
index 72044e5ef3..a7239698f8 100755
--- c/git-send-email.perl
+++ w/git-send-email.perl
@@ -747,6 +747,20 @@ sub is_format_patch_arg {
}
}
+# Now, if the user who wants --translate knows that the command will not
+# send any mails and the remainder of the command line are aliases to be
+# expanded, the user wouldn't have given useless other options to trigger
+# any of the executable code before this point (like $suppress_cc{} handling)
+# that would be wasted. So we just see if --translate is given and deal
+# with it here.
+
+if ($translate_alias) {
+ for (@ARGV) {
+ print "$_ => $aliases{$_}\n";
+ }
+ exit(0);
+}
+
# Now that all the defaults are set, process the rest of the command line
# arguments and collect up the files that need to be processed.
my @rev_list_opts;
next prev parent reply other threads:[~2024-08-09 21:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 21:09 [PATCH 0/3] send-email: teach git send-email mode to translate aliases Jacob Keller
2024-08-08 21:09 ` [PATCH 1/3] t90001-send-email.sh: fix quoting for mailrc --dump-aliases test Jacob Keller
2024-08-08 21:09 ` [PATCH 2/3] t9001-send-email.sh: update alias list used for pine test Jacob Keller
2024-08-08 21:10 ` [PATCH 3/3] send-email: teach git send-email option to translate aliases Jacob Keller
2024-08-08 21:57 ` Junio C Hamano
2024-08-09 19:12 ` Jacob Keller
2024-08-09 19:27 ` Junio C Hamano
2024-08-09 19:51 ` Jacob Keller
2024-08-09 21:05 ` Junio C Hamano [this message]
2024-08-10 0:29 ` Jacob Keller
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=xmqqplqhbe4o.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jacob.keller@gmail.com \
--cc=konstantin@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).