difftool: Simplify print_tool_help()

Eliminate a global variable and File::Find usage by building upon
basename() and glob() instead.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
difftool: Eliminate global variables

Organize the script so that it has a single main() function which
calls out to dir_diff() and file_diff() functions. This eliminates
"dir-diff"-specific variables that do not need to be calculated when
performing a regular file-diff.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
difftool: Move option values into a hash

Shorten the "my" declaration for all of the option-specific variables
by wrapping all of them in a hash.  This also gives us a place to
specify default values, should we need them.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
difftool: Call the temp directory "git-difftool"

The "diffall" name was left over from when this functionality was part of
the "git-diffall" script in contrib/.  Make the naming consistent.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
difftool: Use symlinks when diffing against the worktree

Teach difftool's --dir-diff mode to use symlinks to represent
files from the working copy, and make it the default behavior
for the non-Windows platforms.

Using symlinks is simpler and safer since we do not need to
worry about copying files back into the worktree.
The old behavior is still available as --no-symlinks.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
advice: pass varargs to strbuf_vaddf, not strbuf_addf

The advise() function takes a variable number of arguments
and converts them into a va_list object to pass to strbuf
for handling. However, we accidentally called strbuf_addf
(that takes a variable number of arguments) instead of
strbuf_vaddf (that takes a va_list).

This bug dates back to v1.7.8.1-1-g23cb5bf, but we never
noticed because none of the current callers passes a string
with a format specifier in it. And the compiler did not
notice because the format string is not available at
compile time.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit: check committer identity more strictly

The identity of the committer will ultimately be pulled from
the ident code by commit_tree(). However, we make an attempt
to check the author and committer identity early, before the
user has done any manual work like inputting a commit
message. That lets us abort without them having to worry
about salvaging the work from .git/COMMIT_EDITMSG.

The early check for committer ident does not use the
IDENT_STRICT flag, meaning that it would not find an empty
name field. The motivation was presumably because we did not
want to be too restrictive, as later calls might be more lax
(for example, when we create the reflog entry, we do not
care too much about a real name). However, because
commit_tree will always get a strict identity to put in the
commit object itself, there is no point in being lax only to
die later (and in fact it is harmful, because the user will
have wasted time typing their commit message).

Incidentally, this bug was masked prior to 060d4bb, as the
initial loose call would taint the later strict call. So the
commit would succeed (albeit with a bogus committer line in
the commit object), and nobody noticed that our early check
did not match the later one.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mergetool: support --tool-help option like difftool does

This way we do not have to risk the list of tools going out of sync
between the implementation and the documentation.

In the same spirit as bf73fc2 (difftool: print list of valid tools
with '--tool-help', 2012-03-29), trim the list of merge backends in
the documentation.  We do not want to have a complete list of valid
tools; we only want a list to help people guess what kind of things
the tools do to be specified there, and refer them to --tool-help
for a complete list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit: document the temporary commit message file

We do not document COMMIT_EDITMSG at all, but users may want
to know about it for two reasons:

  1. They may want to tell their editor to configure itself
     for formatting a commit message.

  2. If a commit is aborted by an error, the user may want
     to recover the commit message they typed.

Let's put a note in git-commit(1).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'nk/maint-gitweb-log-by-lines'

Teach gitweb to pay attention to various forms of credits that are
similar to "Signed-off-by:" lines.

* nk/maint-gitweb-log-by-lines:
  gitweb: Add support to Link: tag
  gitweb: Handle other types of tag in git_print_log
  gitweb: Cleanup git_print_log()
Merge branch 'tg/ce-namelen-field'

Split lower bits of ce_flags field and creates a new ce_namelen
field in the in-core index structure.

* tg/ce-namelen-field:
  Strip namelen out of ce_flags into a ce_namelen field
Merge branch 'sn/doc-typofix'

* sn/doc-typofix:
  doc: A few minor copy edits.
Merge branch 'mm/mediawiki-usability'

* mm/mediawiki-usability:
  git-remote-mediawiki: allow page names with a ':'
  git-remote-mediawiki: fix incorrect test usage in test
  git-remote-mediawiki: properly deal with invalid remote revisions
  git-remote-mediawiki: show progress information when getting last remote revision
  git-remote-mediawiki: show progress information when listing pages
  git-remote-mediawiki: use --force when adding notes
  git-remote-mediawiki: get rid of O(N^2) loop
  git-remote-mediawiki: make mediafiles export optional
  git-remote-mediawiki: actually send empty comment when they're empty
  git-remote-mediawiki: don't split namespaces with spaces
Merge branch 'jk/mediawiki-credential'

* jk/mediawiki-credential:
  mw-to-git: use git-credential's URL parser
  credential: convert "url" attribute into its parsed subparts
  mw-to-git: check blank credential attributes via length
  docs/credential: minor clarity fixups
Merge branch 'kk/maint-commit-tree'

* kk/maint-commit-tree:
  Revert "git-commit-tree(1): update synopsis"
  commit-tree: resurrect command line parsing updates
Merge branch 'jv/maint-no-ext-diff'

"git diff --no-ext-diff" did not output anything for a typechange
filepair when GIT_EXTERNAL_DIFF is in effect.

* jv/maint-no-ext-diff:
  diff: test precedence of external diff drivers
  diff: correctly disable external_diff with --no-ext-diff
Merge branch 'sl/autoconf'

* sl/autoconf:
  build: reconfigure automatically if configure.ac changes
  build: "make clean" should not remove configure-generated files
  autoconf: use AC_CONFIG_COMMANDS instead of ad-hoc 'config.mak.append'
  autoconf: remove few redundant semicolons
  autoconf: remove some redundant shell indirections
  autoconf: GIT_CONF_APPEND_LINE -> GIT_CONF_SUBST
  autoconf: GIT_CONF_APPEND_LINE: change signature
Merge branch 'th/difftool-diffall'

Finishing touches to difftool --dirdiff.

* th/difftool-diffall:
  difftool: only copy back files modified during directory diff
Merge branch 'jn/make-assembly-in-right-directory'

* jn/make-assembly-in-right-directory:
  Makefile: fix location of listing produced by "make subdir/foo.s"
Merge branch 'jn/block-sha1'

The code to load a word one-byte-at-a-time was optimized into a
word-wide load instruction even when the pointer was not aligned,
which caused issues on architectures that do not like unaligned
access.

* jn/block-sha1:
  Makefile: BLK_SHA1 does not require fast htonl() and unaligned loads
  block-sha1: put expanded macro parameters in parentheses
  block-sha1: avoid pointer conversion that violates alignment constraints