aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-05-23 15:34:08 -0700
committerJunio C Hamano <gitster@pobox.com>2025-05-23 15:34:08 -0700
commitfb67f789b05d46a05d652da43119ea2ac4a57e6f (patch)
tree5ef3f9e948509a5a34e32d0f1143eac931281769
parentMerge branch 'ps/ci-gitlab-enable-msvc-meson-job' (diff)
parentsend-email: try to get fqdn by running hostname -f on Linux and macOS (diff)
downloadgit-fb67f789b05d46a05d652da43119ea2ac4a57e6f.tar.gz
git-fb67f789b05d46a05d652da43119ea2ac4a57e6f.zip
Merge branch 'ag/send-email-hostname-f'
Teach "git send-email" to also consult `hostname -f` for mail domain to compute the identity given to SMTP servers. * ag/send-email-hostname-f: send-email: try to get fqdn by running hostname -f on Linux and macOS
-rwxr-xr-xgit-send-email.perl16
1 files changed, 15 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 55b7e00d29..659e6c588b 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1393,8 +1393,22 @@ sub maildomain_mta {
return $maildomain;
}
+sub maildomain_hostname_command {
+ my $maildomain;
+
+ if ($^O eq 'linux' || $^O eq 'darwin') {
+ my $domain = `(hostname -f) 2>/dev/null`;
+ if (!$?) {
+ chomp($domain);
+ $maildomain = $domain if valid_fqdn($domain);
+ }
+ }
+ return $maildomain;
+}
+
sub maildomain {
- return maildomain_net() || maildomain_mta() || 'localhost.localdomain';
+ return maildomain_net() || maildomain_mta() ||
+ maildomain_hostname_command || 'localhost.localdomain';
}
sub smtp_host_string {