Skip to content

Commit

Permalink
send-email: do not reverse the command line arguments
Browse files Browse the repository at this point in the history
The loop picks elements from @ARGV one by one, sifts them into arguments
meant for format-patch and the script itself, and pushes them to @files
and @rev_list_opts arrays.  Pick elements from @ARGV starting at the
beginning using shift, instead of at the end using pop, as push appends
them to the end of the array.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Dec 1, 2008
1 parent 7f871c6 commit 69f4ce5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ ($)
# 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;
while (my $f = pop @ARGV) {
while (defined(my $f = shift @ARGV)) {
if ($f eq "--") {
push @rev_list_opts, "--", @ARGV;
@ARGV = ();
Expand Down
13 changes: 13 additions & 0 deletions t/t9001-send-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,17 @@ test_expect_success 'detects ambiguous reference/file conflict' '
grep disambiguate errors
'

test_expect_success 'feed two files' '
rm -fr outdir &&
git format-patch -2 -o outdir &&
GIT_SEND_EMAIL_NOTTY=1 git send-email \
--dry-run \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
outdir/000?-*.patch 2>errors >out &&
grep "^Subject: " out >subjects &&
test "z$(sed -n -e 1p subjects)" = "zSubject: [PATCH 1/2] Second." &&
test "z$(sed -n -e 2p subjects)" = "zSubject: [PATCH 2/2] add master"
'

test_done

0 comments on commit 69f4ce5

Please sign in to comment.