diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-06-03 12:06:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-03 12:06:44 -0700 |
commit | 0b4494625d97088afe95845b4c69dc16af8c62e9 (patch) | |
tree | 882c5bcb6e4f1e4e6f12beb0bded4938668ae068 | |
parent | Merge branch 'jx/blame-align-relative-time' (diff) | |
parent | send-email: windows drive prefix (e.g. C:) appears only at the beginning (diff) | |
download | tgif-0b4494625d97088afe95845b4c69dc16af8c62e9.tar.xz |
Merge branch 'ef/send-email-absolute-path-to-the-command'
* ef/send-email-absolute-path-to-the-command:
send-email: windows drive prefix (e.g. C:) appears only at the beginning
send-email: recognize absolute path on Windows
-rwxr-xr-x | git-send-email.perl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index fdb0029b59..abd62b484c 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1113,6 +1113,18 @@ sub ssl_verify_params { } } +sub file_name_is_absolute { + my ($path) = @_; + + # msys does not grok DOS drive-prefixes + if ($^O eq 'msys') { + return ($path =~ m#^/# || $path =~ m#^[a-zA-Z]\:#) + } + + require File::Spec::Functions; + return File::Spec::Functions::file_name_is_absolute($path); +} + # Returns 1 if the message was sent, and 0 otherwise. # In actuality, the whole program dies when there # is an error sending a message. @@ -1197,7 +1209,7 @@ X-Mailer: git-send-email $gitversion if ($dry_run) { # We don't want to send the email. - } elsif ($smtp_server =~ m#^/#) { + } elsif (file_name_is_absolute($smtp_server)) { my $pid = open my $sm, '|-'; defined $pid or die $!; if (!$pid) { @@ -1271,7 +1283,7 @@ X-Mailer: git-send-email $gitversion printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject); } else { print (($dry_run ? "Dry-" : "")."OK. Log says:\n"); - if ($smtp_server !~ m#^/#) { + if (!file_name_is_absolute($smtp_server)) { print "Server: $smtp_server\n"; print "MAIL FROM:<$raw_from>\n"; foreach my $entry (@recipients) { |