Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-03-09 09:12:37 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-09 19:37:27 +0300
commit8d5213decff887b2d950b732e37b7abad6f8d450 (patch)
tree89813311250026a5efbb0509ffd2f0e553fd8fe6 /t/t4014-format-patch.sh
parentc169af8f7ab521cc47b59f104db78847e324a3cb (diff)
format-patch: add format.noprefix option
The previous commit dropped support for diff.noprefix in format-patch. While this will do the right thing in most cases (where sending patches without a prefix was an accidental side effect of the sender preferring to see their local patches without prefixes), it left no good option for a project or workflow where you really do want to send patches without prefixes. You'd be stuck using "--no-prefix" for every invocation. So let's add a config option specific to format-patch that enables this behavior. That gives people who have such a workflow a way to get what they want, but makes it hard to accidentally trigger it. A more backwards-compatible way of doing the transition would be to have format.noprefix default to diff.noprefix when it's not set. But that doesn't really help the "accidental" problem; people would have to manually set format.noprefix=false. And it's unlikely that anybody really wants format.noprefix=true in the first place. I'm adding it here mostly as an escape hatch, not because anybody has expressed any interest in it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index f5a41fd47e..2711fd09ca 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -2391,4 +2391,15 @@ test_expect_success 'format-patch does not respect diff.noprefix' '
grep "^--- a/blorp" actual
'
+test_expect_success 'format-patch respects format.noprefix' '
+ git -c format.noprefix format-patch -1 --stdout >actual &&
+ grep "^--- blorp" actual
+'
+
+test_expect_success 'format-patch --default-prefix overrides format.noprefix' '
+ git -c format.noprefix \
+ format-patch -1 --default-prefix --stdout >actual &&
+ grep "^--- a/blorp" actual
+'
+
test_done