Skip to content

Commit

Permalink
git-send-email: Better handling of EOF
Browse files Browse the repository at this point in the history
Before, when the user sent the EOF control character, the
prompts would be repeated on the same line as the previous
prompt.

Now, repeat prompts display on separate lines.

Signed-off-by: Michael Witten <mfwitten@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Witten authored and Junio C Hamano committed Feb 5, 2008
1 parent 8742997 commit 8a7c56e
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -376,20 +376,27 @@ sub read_config {
my $prompting = 0;
if (!defined $sender) {
$sender = $repoauthor || $repocommitter;
do {

while (1) {
$_ = $term->readline("Who should the emails appear to be from? [$sender] ");
} while (!defined $_);
last if defined $_;
print "\n";
}

$sender = $_ if ($_);
print "Emails will be sent from: ", $sender, "\n";
$prompting++;
}

if (!@to) {
do {
$_ = $term->readline("Who should the emails be sent to? ",
"");
} while (!defined $_);


while (1) {
$_ = $term->readline("Who should the emails be sent to? ", "");
last if defined $_;
print "\n";
}

my $to = $_;
push @to, split /,/, $to;
$prompting++;
Expand All @@ -411,19 +418,22 @@ sub expand_aliases {
@bcclist = expand_aliases(@bcclist);

if (!defined $initial_subject && $compose) {
do {
$_ = $term->readline("What subject should the initial email start with? ",
$initial_subject);
} while (!defined $_);
while (1) {
$_ = $term->readline("What subject should the initial email start with? ", $initial_subject);
last if defined $_;
print "\n";
}

$initial_subject = $_;
$prompting++;
}

if ($thread && !defined $initial_reply_to && $prompting) {
do {
$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
$initial_reply_to);
} while (!defined $_);
while (1) {
$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ", $initial_reply_to);
last if defined $_;
print "\n";
}

$initial_reply_to = $_;
}
Expand Down Expand Up @@ -474,9 +484,11 @@ sub expand_aliases {
close(C);
close(C2);

do {
while (1) {
$_ = $term->readline("Send this email? (y|n) ");
} while (!defined $_);
last if defined $_;
print "\n";
}

if (uc substr($_,0,1) ne 'Y') {
cleanup_compose_files();
Expand Down

0 comments on commit 8a7c56e

Please sign in to comment.