タイトルの通り。
メーリングリストでコードの議論や修正が行われているコミュニティに対しては、Eメールでパッチを送る必要がある
その際、git send-email
コマンドを使用することで、テキストが崩れることなく送信が可能となる
検証環境:
- Fedora 36
- git / git-email 2.37.3
メールアカウント:yahooメール
パスワードを使用した SMTP 認証でメールを送信するため、今回は設定が簡単なyahooメールで検証を行っている
git send-email コマンドを使用するためには、 git-email パッケージをインストールする必要がある
dnf install git-email
パッケージ導入後、gitconfig
にsmtpサーバの情報を記載する
パスワードが平文なのがいただけない
[halni@Fedora-build ~]$ cat .gitconfig ...(略)... [sendemail] smtpserver = smtp.mail.yahoo.co.jp smtpuser = アカウントのユーザー名 smtpencryption = ssl smtppass = yahooアカウントのパスワード smtpserverport = 465 ...(略)...
これで前提準備は完了
実際にPatchをメールで送信してみる
まず適当なPatchを作成
[halni@Fedora-build git-test]$ vim exec.sh [halni@Fedora-build git-test]$ git add exec.sh [halni@Fedora-build git-test]$ git commit -m "Modify display message" [master a2962da] Modify display message 1 file changed, 1 insertion(+), 1 deletion(-) [halni@Fedora-build git-test]$ git format-patch -1 0001-Modify-display-message.patch [halni@Fedora-build git-test]$ ls 0001-Modify-display-message.patch exec.sh ★ 0001-Modify-message.patch が作成された [halni@Fedora-build git-test]$
作成したPatchはこんな感じ
[halni@Fedora-build git-test]$ cat 0001-Modify-display-message.patch From a2962da6dfd9bf9b1d7b6352c041a5d90a792f01 Mon Sep 17 00:00:00 2001 From: halni <xxx@yahoo.co.jp> Date: Tue, 25 Oct 2022 21:11:23 +0900 Subject: [PATCH] Modify display message --- exec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.sh b/exec.sh index 5dd3a27..fb25e7c 100644 --- a/exec.sh +++ b/exec.sh @@ -1,3 +1,3 @@ #!/bin/sh -echo git-test!! +echo git-test modify!! -- 2.37.3 [halni@Fedora-build git-test]$
このPatchをメール送信する
git send-email 送信するPatch
を実行後、対話式に送信先メールアドレス等を入力していく
[halni@Fedora-build git-test]$ git send-email 0001-Modify-display-message.patch 0001-Modify-display-message.patch To whom should the emails be sent (if anyone)? yyy@gmail.com Message-ID to be used as In-Reply-To for the first email (if any)? (mbox) Adding cc: halni <xxx@yahoo.co.jp> from line 'From: halni <xxx@yahoo.co.jp>' From: halni <xxx@yahoo.co.jp> To: yyy@gmail.com Cc: halni <xxx@yahoo.co.jp> Subject: [PATCH] Modify display message Date: Tue, 25 Oct 2022 21:13:05 +0900 Message-Id: <20221025121305.4618-1-xxx@yahoo.co.jp> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The Cc list above has been expanded by additional addresses found in the patch commit message. By default send-email prompts before sending whenever this occurs. This behavior is controlled by the sendemail.confirm configuration setting. For additional information, run 'git send-email --help'. To retain the current behavior, but squelch this message, run 'git config --global sendemail.confirm auto'. Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): y OK. Log says: Server: smtp.mail.yahoo.co.jp MAIL FROM:<xxx@yahoo.co.jp> RCPT TO:<yyy@gmail.com> RCPT TO:<xxx@yahoo.co.jp> From: halni <xxx@yahoo.co.jp> To: yyy@gmail.com Cc: halni <xxx@yahoo.co.jp> Subject: [PATCH] Modify display message Date: Tue, 25 Oct 2022 21:13:05 +0900 Message-Id: <20221025121305.4618-1-xxx@yahoo.co.jp> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Result: 250 [halni@Fedora-build git-test]$
これで xxx@yahoo.co.jp から yyy@gmail.com へメールが送信される
Patchが受信できていることを確認できた
また、commitメッセージ以外に、追加の文章をメールに含めることもできる
[halni@Fedora-build git-test]$ cat 0001-Modify-display-message.patch From a2962da6dfd9bf9b1d7b6352c041a5d90a792f01 Mon Sep 17 00:00:00 2001 From: halni <xxx@yahoo.co.jp> Date: Tue, 25 Oct 2022 21:11:23 +0900 Subject: [PATCH] Modify display message This change is very important. In previous implementations, when a file was executed, a test message was simply displayed. With this change, however, the file executor is now clearly notified that the file has been modified. --- exec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec.sh b/exec.sh index 5dd3a27..fb25e7c 100644 --- a/exec.sh +++ b/exec.sh @@ -1,3 +1,3 @@ #!/bin/sh -echo git-test!! +echo git-test modify!! -- 2.37.3 [halni@Fedora-build git-test]$
こうするとメール本文にメッセージが追加される
参考: