Code

Merge branch 'ph/format-patch-no-color'
authorJunio C Hamano <gitster@pobox.com>
Thu, 15 Sep 2011 04:43:57 +0000 (21:43 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Sep 2011 04:43:57 +0000 (21:43 -0700)
* ph/format-patch-no-color:
  format-patch: ignore ui.color

1  2 
t/t4014-format-patch.sh

diff --combined t/t4014-format-patch.sh
index 5cbc066e68e15b1015d9b8838b44a8042d4f04fd,15bd4a648a43fc92bdf872055fa2f3d40647681c..7e405d7af667e8406fdbcd57eb2b9f077627fad0
@@@ -179,21 -179,12 +179,21 @@@ test_expect_success 'configuration To: 
        grep "^To: R. E. Cipient <rcipient@example.com>\$" patch9
  '
  
 +# check_patch <patch>: Verify that <patch> looks like a half-sane
 +# patch email to avoid a false positive with !grep
 +check_patch () {
 +      grep -e "^From:" "$1" &&
 +      grep -e "^Date:" "$1" &&
 +      grep -e "^Subject:" "$1"
 +}
 +
  test_expect_success '--no-to overrides config.to' '
  
        git config --replace-all format.to \
                "R. E. Cipient <rcipient@example.com>" &&
        git format-patch --no-to --stdout master..side |
        sed -e "/^\$/q" >patch10 &&
 +      check_patch patch10 &&
        ! grep "^To: R. E. Cipient <rcipient@example.com>\$" patch10
  '
  
@@@ -204,7 -195,6 +204,7 @@@ test_expect_success '--no-to and --to r
        git format-patch --no-to --to="Someone Else <else@out.there>" \
                --stdout master..side |
        sed -e "/^\$/q" >patch11 &&
 +      check_patch patch11 &&
        ! grep "^To: Someone <someone@out.there>\$" patch11 &&
        grep "^To: Someone Else <else@out.there>\$" patch11
  '
@@@ -215,17 -205,15 +215,17 @@@ test_expect_success '--no-cc overrides 
                "C. E. Cipient <rcipient@example.com>" &&
        git format-patch --no-cc --stdout master..side |
        sed -e "/^\$/q" >patch12 &&
 +      check_patch patch12 &&
        ! grep "^Cc: C. E. Cipient <rcipient@example.com>\$" patch12
  '
  
 -test_expect_success '--no-add-headers overrides config.headers' '
 +test_expect_success '--no-add-header overrides config.headers' '
  
        git config --replace-all format.headers \
                "Header1: B. E. Cipient <rcipient@example.com>" &&
 -      git format-patch --no-add-headers --stdout master..side |
 +      git format-patch --no-add-header --stdout master..side |
        sed -e "/^\$/q" >patch13 &&
 +      check_patch patch13 &&
        ! grep "^Header1: B. E. Cipient <rcipient@example.com>\$" patch13
  '
  
@@@ -492,7 -480,6 +492,7 @@@ test_expect_success 'cover-letter inher
        git mv file foo &&
        git commit -m foo &&
        git format-patch --cover-letter -1 &&
 +      check_patch 0000-cover-letter.patch &&
        ! grep "file => foo .* 0 *\$" 0000-cover-letter.patch &&
        git format-patch --cover-letter -1 -M &&
        grep "file => foo .* 0 *\$" 0000-cover-letter.patch
@@@ -670,7 -657,6 +670,7 @@@ test_expect_success 'format-patch --no-
        git config format.signature "config sig" &&
        git format-patch --stdout --signature="my sig" --no-signature \
                -1 >output &&
 +      check_patch output &&
        ! grep "config sig" output &&
        ! grep "my sig" output &&
        ! grep "^-- \$" output
@@@ -687,20 -673,17 +687,20 @@@ test_expect_success 'format-patch --sig
  test_expect_success 'format.signature="" supresses signatures' '
        git config format.signature "" &&
        git format-patch --stdout -1 >output &&
 +      check_patch output &&
        ! grep "^-- \$" output
  '
  
  test_expect_success 'format-patch --no-signature supresses signatures' '
        git config --unset-all format.signature &&
        git format-patch --stdout --no-signature -1 >output &&
 +      check_patch output &&
        ! grep "^-- \$" output
  '
  
  test_expect_success 'format-patch --signature="" supresses signatures' '
 -      git format-patch --signature="" -1 >output &&
 +      git format-patch --stdout --signature="" -1 >output &&
 +      check_patch output &&
        ! grep "^-- \$" output
  '
  
@@@ -886,4 -869,12 +886,12 @@@ test_expect_success 'empty subject pref
        test_cmp expect actual
  '
  
+ test_expect_success 'format patch ignores color.ui' '
+       test_unconfig color.ui &&
+       git format-patch --stdout -1 >expect &&
+       test_config color.ui always &&
+       git format-patch --stdout -1 >actual &&
+       test_cmp expect actual
+ '
  test_done