git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG?] format-patch: --cover-letter doesn't use --from

From
Kristoffer Haugsbakk <code@khaugsbakk.name>
Date
Oct 6, 2024, 18:46 UTC
Message-ID
<95cb9cf15a4f3b17cee5f14fa0bcba9d40a0ebb8.1728239131.git.code@khaugsbakk.name>
From: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
Steps to reproduce is in the test below.

I wanted to send patches with my own domain as the author but using my email provider as the sender.

What did you expect to happen? (Expected behavior)
That the `--from` ident was used for the cover letter and the patches.
What happened instead? (Actual behavior)

The cover letter used my committer ident. It correctly used the `--from` ident for the patches.

What's different between what you expected and what actually happened?
-
Anything else you want to add:
See the test.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.46.2 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh libcurl: 7.81.0 zlib: 1.2.11 uname: Linux 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 11 15:25:05 UTC 2 x86_64 compiler info: gnuc: 11.4 libc info: glibc: 2.35 $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks] post-applypatch post-checkout post-commit post-merge post-rewrite pre-auto-gc reference-transaction sendemail-validate

-- >8 --
Subject: t4014: exercise --from with --cover-letter
From: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---
 t/t4014-format-patch.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 1c46e963e43..41a3fffcd2f 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -2548,4 +2548,14 @@ test_expect_success 'format-patch --default-prefix overrides format.noprefix' '
 	grep "^--- a/blorp" actual
 '
 
+test_expect_success '--cover-letter respects --from' '
+	git format-patch -1 --stdout --cover-letter \
+		--from="Me <me@example.com>" |
+		grep "^From: " | head -1 >actual &&
+	cat <<-\EOF >expect &&
+	From: Me <me@example.com>
+	EOF
+	test_cmp expect actual
+'
+
 test_done
-- 
2.46.1.641.g54e7913fcb6
Message 1 of 1 in “[BUG?] format-patch: --cover-letter doesn't use --from”
  1. Kristoffer HaugsbakkOct 6, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.