Merge branch 'fc/send-email-annotate'
authorJunio C Hamano <gitster@pobox.com>
Thu, 18 Apr 2013 18:49:11 +0000 (11:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Apr 2013 18:49:11 +0000 (11:49 -0700)
Allows format-patch --cover-letter to be configurable; the most
notable is the "auto" mode to create cover-letter only for multi
patch series.

* fc/send-email-annotate:
rebase-am: explicitly disable cover-letter
format-patch: trivial cleanups
format-patch: add format.coverLetter configuration variable
log: update to OPT_BOOL
format-patch: refactor branch name calculation
format-patch: improve head calculation for cover-letter
send-email: make annotate configurable

1  2 
Documentation/config.txt
t/t4014-format-patch.sh
diff --combined Documentation/config.txt
index 3d750e0452308a4d3bf15053bfc5131d43c8c913,83b924494c30bf5d8180ab7592536fb5b9d44b69..42b0f3ba42d60d8f321808a0f3f02d7195ecc5c0
@@@ -727,22 -727,9 +727,22 @@@ branch.autosetuprebase:
        This option defaults to never.
  
  branch.<name>.remote::
 -      When in branch <name>, it tells 'git fetch' and 'git push' which
 -      remote to fetch from/push to.  It defaults to `origin` if no remote is
 -      configured. `origin` is also used if you are not on any branch.
 +      When on branch <name>, it tells 'git fetch' and 'git push'
 +      which remote to fetch from/push to.  The remote to push to
 +      may be overridden with `remote.pushdefault` (for all branches).
 +      The remote to push to, for the current branch, may be further
 +      overridden by `branch.<name>.pushremote`.  If no remote is
 +      configured, or if you are not on any branch, it defaults to
 +      `origin` for fetching and `remote.pushdefault` for pushing.
 +
 +branch.<name>.pushremote::
 +      When on branch <name>, it overrides `branch.<name>.remote` for
 +      pushing.  It also overrides `remote.pushdefault` for pushing
 +      from branch <name>.  When you pull from one place (e.g. your
 +      upstream) and push to another place (e.g. your own publishing
 +      repository), you would want to set `remote.pushdefault` to
 +      specify the remote to push to for all branches, and use this
 +      option to override it for a specific branch.
  
  branch.<name>.merge::
        Defines, together with branch.<name>.remote, the upstream branch
@@@ -1109,6 -1096,11 +1109,11 @@@ format.signoff:
      the rights to submit this work under the same open source license.
      Please see the 'SubmittingPatches' document for further discussion.
  
+ format.coverLetter::
+       A boolean that controls whether to generate a cover-letter when
+       format-patch is invoked, but in addition can be set to "auto", to
+       generate a cover-letter only when there's more than one patch.
  filter.<driver>.clean::
        The command which is used to convert the content of a worktree
        file to a blob upon checkin.  See linkgit:gitattributes[5] for
@@@ -1911,11 -1903,6 +1916,11 @@@ receive.updateserverinfo:
        If set to true, git-receive-pack will run git-update-server-info
        after receiving data from git-push and updating refs.
  
 +remote.pushdefault::
 +      The remote to push to by default.  Overrides
 +      `branch.<name>.remote` for all branches, and is overridden by
 +      `branch.<name>.pushremote` for specific branches.
 +
  remote.<name>.url::
        The URL of a remote repository.  See linkgit:git-fetch[1] or
        linkgit:git-push[1].
@@@ -2016,6 -2003,7 +2021,7 @@@ sendemail.<identity>.*:
  
  sendemail.aliasesfile::
  sendemail.aliasfiletype::
+ sendemail.annotate::
  sendemail.bcc::
  sendemail.cc::
  sendemail.cccmd::
diff --combined t/t4014-format-patch.sh
index 86ee0771077a9da0404a276873c81dd17600ceb4,8368181d6ce7a94a620a46fd300c57521e72a825..58d418098d793b284bb4a7222cf9709c45b26c90
@@@ -742,21 -742,21 +742,21 @@@ test_expect_success 'format-patch --sig
        test 2 = $(grep "my sig" output | wc -l)
  '
  
 -test_expect_success 'format.signature="" supresses signatures' '
 +test_expect_success 'format.signature="" suppresses 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' '
 +test_expect_success 'format-patch --no-signature suppresses 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' '
 +test_expect_success 'format-patch --signature="" suppresses signatures' '
        git format-patch --stdout --signature="" -1 >output &&
        check_patch output &&
        ! grep "^-- \$" output
@@@ -1284,4 -1284,37 +1284,37 @@@ test_expect_success 'cover letter usin
        grep hello actual >/dev/null
  '
  
+ test_expect_success 'cover letter with nothing' '
+       git format-patch --stdout --cover-letter >actual &&
+       test_line_count = 0 actual
+ '
+ test_expect_success 'cover letter auto' '
+       mkdir -p tmp &&
+       test_when_finished "rm -rf tmp;
+               git config --unset format.coverletter" &&
+       git config format.coverletter auto &&
+       git format-patch -o tmp -1 >list &&
+       test_line_count = 1 list &&
+       git format-patch -o tmp -2 >list &&
+       test_line_count = 3 list
+ '
+ test_expect_success 'cover letter auto user override' '
+       mkdir -p tmp &&
+       test_when_finished "rm -rf tmp;
+               git config --unset format.coverletter" &&
+       git config format.coverletter auto &&
+       git format-patch -o tmp --cover-letter -1 >list &&
+       test_line_count = 2 list &&
+       git format-patch -o tmp --cover-letter -2 >list &&
+       test_line_count = 3 list &&
+       git format-patch -o tmp --no-cover-letter -1 >list &&
+       test_line_count = 1 list &&
+       git format-patch -o tmp --no-cover-letter -2 >list &&
+       test_line_count = 2 list
+ '
  test_done