t/t7502: compare entire commit message with what was expected

This test attempts to verify that a commit in "verbatim" mode, when
supplied a commit template, produces a commit in which the commit
message matches exactly the template that was supplied.  But, since the
commit operation appends additional instructions for the user as
comments in the commit buffer, which would cause the comparison to fail,
this test decided to compare only the first three lines (the length of
the template) of the resulting commit message to the original template
file.

This has two problems.

  1. It does not allow the template to be lengthened or shortened
     without also modifying the number of lines that are considered
     significant (i.e. the argument to 'head -n').
  2. It will not catch a bug in git that causes git to append additional
     lines to the commit message.

So, let's use the --no-status option to 'git commit' which will cause
git to refrain from appending the lines of instructional text to the
commit message.  This will allow the entire resulting commit message to
be compared against the expected value.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t7502: demonstrate breakage with a commit message with trailing newlines

This test attempts to verify that a commit message supplied to 'git
commit' via the -m switch was used in full as the commit message for a
commit when --cleanup=verbatim was used.

But, this test has been broken since it was introduced.  Since the
commit message containing trailing newlines was supplied to 'git commit'
using a command substitution, the trailing newlines were removed by the
shell.  This means that a string without any trailing newlines was
actually supplied to 'git commit'.

The test was able to complete successfully since internally, git appends
two newlines to each string supplied via the -m switch.  So, the two
newlines removed by the shell were then re-added by git, and the
resulting commit matched what was expected.

So, let's move the initial creation of the commit message string out
from within a previous test so that it stands alone.  Assign the desired
commit message to a variable using literal newlines.  Then populate the
expect file from the contents of the commit message variable.  This way
the shell variable becomes the authoritative source of the commit
message and can be supplied via the -m switch with the trailing newlines
intact.

Mark this test as failing, since it is not handled correctly by git.
As described above, git appends two extra newlines to every string
supplied via -m, even to the ones that already end with a newline.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-commit: only append a newline to -m mesg if necessary

Currently, git will append two newlines to every message supplied via
the -m switch.  The purpose of this is to allow -m to be supplied
multiple times and have each supplied string become a paragraph in the
resulting commit message.

Normally, this does not cause a problem since any trailing newlines will
be removed by the cleanup operation.  If cleanup=verbatim for example,
then the trailing newlines will not be removed and will survive into the
resulting commit message.

Instead, let's ensure that the string supplied to -m is newline terminated,
but only append a second newline when appending additional messages.

Fixes the test in t7502.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-commit.txt: rework the --cleanup section

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
user-manual: Reorganize the reroll sections, adding 'git rebase -i'

I think this interface is often more convenient than extended cherry
picking or using 'git format-patch'.  In fact, I removed the
cherry-pick section entirely.  The entry-level suggestions for
rerolling are now:

    1. git commit --amend
    2. git format-patch origin
       git reset --hard origin
       ...edit and reorder patches...
       git am *.patch
    3. git rebase -i origin

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
user-manual: Use request-pull to generate "please pull" text

Less work and more error checking (e.g. does a merge base exist?).
Add an explicit push before request-pull to satisfy request-pull,
which checks to make sure the references are publically available.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
user-manual: Flesh out uncommitted changes and submodule updates

If you try and update a submodule with a dirty working directory, you
get an error message like:

  $ git submodule update
  error: Your local changes to the following files would be overwritten by checkout:
  ...
  Please, commit your changes or stash them before you can switch branches.
  Aborting
  ...

Mention this in the submodule notes.  The previous phrase was short
enough that I originally thought it might have been referring to the
reflog note (obviously, uncommitted changes will not show up in the
reflog either ;).

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'bc/commit-complete-lines-given-via-m-option' into next

* bc/commit-complete-lines-given-via-m-option:
  Documentation/git-commit.txt: rework the --cleanup section
  git-commit: only append a newline to -m mesg if necessary
  t7502: demonstrate breakage with a commit message with trailing newlines
  t/t7502: compare entire commit message with what was expected
Merge branch 'wk/user-manual' into next

* wk/user-manual:
  user-manual: Flesh out uncommitted changes and submodule updates
  user-manual: Use request-pull to generate "please pull" text
  user-manual: Reorganize the reroll sections, adding 'git rebase -i'
Merge branch 'master' into next

* master:
  Git 1.8.1.4
  imap-send: support subjectAltName as well
  imap-send: the subject of SSL certificate must match the host
  imap-send: move #ifdef around
Merge branch 'jk/blame-tree' into HEAD

* jk/blame-tree:
  add blame-tree command
  combine-diff: zero memory used for callback filepairs
  teach tree-diff a max-depth parameter
  within_depth: fix return for empty path
Merge branch 'jk/builtin-attr' into HEAD

* jk/builtin-attr:
  attr: map builtin userdiff drivers to well-known extensions
Merge branch 'jk/bundle-fetch' into HEAD

* jk/bundle-fetch:
  clone: give advice on how to resume a failed clone
  remote-curl: resume interrupted bundle transfers
  remote-curl: show progress for bundle downloads
  progress: allow pure-throughput progress meters
  remote-curl: try base $URL after $URL/info/refs
  remote-curl: auto-detect bundles when fetching refs
  remote-curl: free "discovery" object
  bundle: add is_bundle_buf helper
  transport: factor out bundle to ref list conversion
  remote-curl: use http callback for requesting refs
  http: add a public function for arbitrary-callback request
  http: refactor http_request function
  http: turn off curl signals
  t/lib-httpd: check for NO_CURL
Merge branch 'jk/cache-patch-id' into HEAD

* jk/cache-patch-id:
  cache patch ids on disk
  cherry: read default config
  implement metadata cache subsystem
  map: implement persistent maps
  decorate: use "map" for the underlying implementation
  fast-export: use object to uint32 map instead of "decorate"
  map: add helper functions for objects as keys
  implement generic key/value map
Merge branch 'jk/child-cleanup' into HEAD

* jk/child-cleanup:
  send-pack: kill pack-objects helper on signal or exit
Merge branch 'jk/clone-file-local' into HEAD

* jk/clone-file-local:
  clone: send diagnostic messages to stderr
Merge branch 'jk/completion-quoting' into HEAD

* jk/completion-quoting:
  don't use quotemeta
  super speed with sed and perl
  completion: quote completions we find
  completion: improve shell expansion of items
Merge branch 'jk/config-sources' into HEAD

* jk/config-sources:
  show sources of config options (WIP)
Merge branch 'jk/describe' into HEAD

* jk/describe:
  describe WIP
Merge branch 'jk/diff-funcname-context' into HEAD

* jk/diff-funcname-context:
  xdiff: find funcnames starting from changed lines
  t4018: drop test_config definition

Conflicts:
	t/t4018-diff-funcname.sh