summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2009-11-04 07:19:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-11-09 01:01:36 (GMT)
commit1d46f2ea143534e46e6bfee3f34cd90b734bfe80 (patch)
treeeae8ece6e65ceb4ebb8880f7227f7e4cbe132a6e /t/t4014-format-patch.sh
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0 (diff)
downloadgit-1d46f2ea143534e46e6bfee3f34cd90b734bfe80.zip
git-1d46f2ea143534e46e6bfee3f34cd90b734bfe80.tar.gz
git-1d46f2ea143534e46e6bfee3f34cd90b734bfe80.tar.bz2
format-patch: make "-p" suppress diffstat
Once upon a time, format-patch would use its default stat plus patch format only when no diff format was given on the command line. This meant that "format-patch -p" would suppress the stat and show just the patch. Commit 68daa64 changed this to keep the stat format when we had an "implicit" patch format, like "-U5". As a side effect, this meant that an explicit patch format was now ignored (because cmd_format_patch didn't know the reason that the format was set way down in diff_opt_parse). This patch unbreaks what 68daa64 did (while still preserving what 68daa64 was trying to do), reinstating "-p" to suppress the default behavior. We do this by parsing "-p" ourselves in format-patch, and noting whether it was used explicitly. 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.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 531f5b7..cab6ce2 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -455,6 +455,27 @@ test_expect_success 'format-patch respects -U' '
'
+cat > expect << EOF
+
+diff --git a/file b/file
+index 40f36c6..2dc5c23 100644
+--- a/file
++++ b/file
+@@ -14,3 +14,19 @@ C
+ D
+ E
+ F
++5
+EOF
+
+test_expect_success 'format-patch -p suppresses stat' '
+
+ git format-patch -p -2 &&
+ sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
+ test_cmp expect output
+
+'
+
test_expect_success 'format-patch from a subdirectory (1)' '
filename=$(
rm -rf sub &&