update-index: fix segfault with missing --cacheinfo argument

Running "git update-index --cacheinfo" without any further
arguments results in a segfault rather than an error
message. Commit ec160ae (update-index: teach --cacheinfo a
new syntax "mode,sha1,path", 2014-03-23) added code to
examine the format of the argument, but forgot to handle the
NULL case.

Returning an error from the parser is enough, since we then
treat it as an old-style "--cacheinfo <mode> <sha1> <path>",
and complain that we have less than 3 arguments to read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t5000, t5003: do not use test_cmp to compare binary files

test_cmp() is primarily meant to compare text files (and display the
difference for debug purposes).

Raw "cmp" is better suited to compare binary files (tar, zip, etc.).

On MinGW, test_cmp is a shell function mingw_test_cmp that tries to
read both files into environment, stripping CR characters (introduced
in commit 4d715ac0).

This function usually speeds things up, as fork is extremly slow on
Windows.  But no wonder that this function is extremely slow and
sometimes even crashes when comparing large tar or zip files.

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
shortlog: allow --exclude=<glob> to be passed

These two commands are supposed to be equivalent:

  $ git log --exclude=refs/notes/\* --all --no-merges --since=2.days |
    git shortlog
  $ git shortlog --exclude=refs/notes/\* --all --no-merges --since=2.days

However, the latter does not understand the ref-exclusion command
line option, even though other options understood by "log", such as
"--all" and "--no-merges", are understood.

This was because e7b432c5 (revision: introduce --exclude=<glob> to
tame wildcards, 2013-08-30) did not wire the new option fully to the
machinery.  A new option understood by handle_revision_pseudo_opt()
must be told to handle_revision_opt() as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch doc: on pulling multiple refspecs

Replace desription of old-style "Pull:" lines in remotes/
configuration with modern remote.*.fetch variables.

As this note applies only to "git pull", enable it only
in git-pull manual page.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch doc: update refspec format description

The text made it sound as if the leading plus is the only thing that
is optional, and forgot that <lhs> is the same as <lhs>:, i.e. fetch
it and do not store anywhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch doc: remove "short-cut" section

It is misleading to mention that <ref> that does not store is to
fetch the ref into FETCH_HEAD, because a refspec that does store is
also to fetch the LHS into FETCH_HEAD.  It is doubly misleading to
list it as part of "short-cut".  <ref> stands for a refspec that has
it on the LHS with a colon and an empty RHS, and that definition
should be given at the beginning of the entry where the format is
defined.

Tentatively remove this misleading description, which leaves the
`tag <tag>` as the only true short-hand, so move it at the beginning
of the entry.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch doc: add a section on configured remote-tracking branches

To resurrect a misleading mention removed in the previous step,
add a section to explain how the remote-tracking configuration
interacts with the refspecs given as the command-line arguments.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch: allow explicit --refmap to override configuration

Since the introduction of opportunisitic updates of remote-tracking
branches, started at around f2690487 (fetch: opportunistically
update tracking refs, 2013-05-11) with a few updates in v1.8.4 era,
the remote.*.fetch configuration always kicks in even when a refspec
to specify what to fetch is given on the command line, and there is
no way to disable or override it per-invocation.

Teach the command to pay attention to the --refmap=<lhs>:<rhs>
command-line options that can be used to override the use of
configured remote.*.fetch as the refmap.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Merge branch 'jc/fetch-push-refmap' into jch

* jc/fetch-push-refmap:
  fetch: allow explicit --refmap to override configuration
  fetch doc: add a section on configured remote-tracking branches
  fetch doc: remove "short-cut" section
  fetch doc: update refspec format description
  fetch doc: on pulling multiple refspecs
  fetch doc: remove notes on outdated "mixed layout"
  fetch doc: update note on '+' in front of the refspec
  fetch doc: move FETCH_HEAD material lower and add an example
  fetch doc: update introductory part for clarity
Merge branch 'na/no-http-test-in-the-middle' into jch

* na/no-http-test-in-the-middle:
  t5538: move http push tests out to t5542
Merge branch 'jc/shortlog-ref-exclude' into jch

* jc/shortlog-ref-exclude:
  shortlog: allow --exclude=<glob> to be passed

# Conflicts:
# 	revision.c
# 	t/t4201-shortlog.sh
Merge branch 'lt/log-auto-decorate' into jch

* lt/log-auto-decorate:
  git log: support "auto" decorations
Merge branch 'ss/userdiff-update-csharp-java' into jch

* ss/userdiff-update-csharp-java:
  userdiff: support Java try keyword
  userdiff: support C# async methods and correct C# keywords
Merge branch 'rs/pack-objects-no-unnecessary-realloc' into jch

* rs/pack-objects-no-unnecessary-realloc:
  pack-objects: use free()+xcalloc() instead of xrealloc()+memset()
Merge branch 'sh/enable-preloadindex' into jch

* sh/enable-preloadindex:
  environment.c: enable core.preloadindex by default
Merge branch 'ta/string-list-init' into jch

* ta/string-list-init:
  string-list: Add a value to string_list initializer lists
Merge branch 'jk/error-resolve-conflict-advice' into jch

* jk/error-resolve-conflict-advice:
  error_resolve_conflict: drop quotations around operation
  error_resolve_conflict: rewrap advice message
Merge branch 'jc/rev-parse-argh-dashed-multi-words' into jch

* jc/rev-parse-argh-dashed-multi-words:
  update-index: fix segfault with missing --cacheinfo argument
Merge branch 'sk/test-cmp-bin' into jch

* sk/test-cmp-bin:
  t5000, t5003: do not use test_cmp to compare binary files
t9001: avoid non-portable '\n' with sed

t9001 used a '\n' in a sed expression to split one line into two
lines.  Some versions of sed (/usr/bin/sed under Mac OS X) simply
ignore the '\' before the 'n', treating '\n' as 'n'.

As the test already requires perl as a prerequisite, use perl
instead of sed.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>