t9903: include "Bash" in test names via new $shellname var

Define a new 'shellname' variable in lib-bash.sh and use it in the
prompt test names.  This is a step toward moving the shell prompt
tests to a separate library file so that they can be reused to test
prompting in Zsh.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t9903: move PS1 color code variable definitions to lib-bash.sh

Define a new 'set_ps1_format_vars' function in lib-bash.sh that sets
the c_red, c_green, c_lblue, and c_clear variables.  Call this
function from run_pcmode_tests().  This is a step toward moving the
shell prompt tests to a separate library file so that they can be
reused to test prompting in Zsh.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t9903: move prompt tests to a new lib-prompt-tests.sh file

This is a step toward creating a new test script that runs the same
prompt tests as t9903 but with Zsh instead of Bash.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
lib-prompt-tests.sh: put all tests inside a function

Modify lib-prompt-tests.sh so that it does nothing when sourced except
define a function for running the prompt tests (plus some "private"
helper functions).

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
lib-prompt-tests.sh: add variable for string that encodes percent in PS1

To add a literal percent character to a Zsh prompt, the string "%%" is
used in PS1.  Bash and POSIX shells simply use "%".  To accommodate
this difference, use ${percent} where a percent character is expected
and define the percent variable in the set_ps1_format_vars function.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
test-lib: make it possible to override how test code is eval'd

If a command named 'test_eval_override' exists, use it instead of
'eval' to run the test code.

This is needed to support zsh test cases:  test-lib.sh must be sourced
in sh emulation mode due to fundamental incompatibilities between the
POSIX sh language and the zsh language.  When a function is defined
while zsh is emulating some shell, zsh notes the shell that is being
emulated and records it along with the function definition.  This
enables zsh to temporarily re-enable the shell emulation mode whenever
the function is called, allowing zsh scripts to mix and match code
written for different shell languages.  (This description of zsh shell
emulation is not completely accurate, but it's close enough.)

Because test_eval_ is defined while zsh is in sh emulation mode, the
shell code passed as an argument to test_expect_success would normally
be evaluated in sh emulation mode.  However, with this change, it is
now possible to evaluate the test code in zsh mode by adding the
following line to a zsh-based test script:

    emulate -R zsh -c 'test_eval_override () { eval "$*"; }'

With test_eval_override defined in zsh emulation mode, the call to
test_eval_override from test_eval_ will temporarily cause zsh to
switch from sh emulation mode to zsh emulation mode.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t9904: new __git_ps1 tests for Zsh

These are the same tests as in t9903, but run in zsh instead of bash.

Signed-off-by: Richard Hansen <rhansen@bbn.com>
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>
---
refs.c: optimize check_refname_component()

In a repository with many refs, check_refname_component can be a major
contributor to the runtime of some git commands. One such command is

git rev-parse HEAD

Timings for one particular repo, with about 60k refs, almost all
packed, are:

Old: 35 ms
New: 29 ms

Many other commands which read refs are also sped up.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'mm/pager-less-sans-S'

Since the very beginning of Git, we gave the LESS environment a
default value "FRSX" when we spawn "less" as the pager.  "S" (chop
long lines instead of wrapping) has been removed from this default
set of options, because it is more or less a personal taste thing,
as opposed to others that have good justifications (i.e. "R" is very
much justified because many kinds of output we produce are colored
and "FX" is justified because output we produce is often shorter
than a page).

Existing users who prefer not to see line-wrapped output may want to
set

  $ git config core.pager "less -S"

to restore the traditional behaviour.  It is expected that people
find output from the most subcommands easier to read with the new
default, except for "blame" which tends to produce really long
lines.  To override the new default only for "git blame", you can do
this:

  $ git config pager.blame "less -S"

* mm/pager-less-sans-S:
  pager: remove 'S' from $LESS by default
Merge branch 'jk/commit-C-pick-empty'

"git commit --allow-empty-message -C $commit" did not work when the
commit did not have any log message.

* jk/commit-C-pick-empty:
  commit: do not complain of empty messages from -C
Merge branch 'je/pager-do-not-recurse'

We used to unconditionally disable the pager in the pager process
we spawn to feed out output, but that prevented people who want to
run "less" within "less" from doing so.

* je/pager-do-not-recurse:
  pager: do allow spawning pager recursively
Merge branch 'da/imap-send-use-credential-helper'

"git imap-send" learns to ask the credential helper for
authentication material.

* da/imap-send-use-credential-helper:
  imap-send: use git-credential
Merge branch 'jk/utf8-switch-between-nfd-and-nfc'

Document a known breakage with a test.

* jk/utf8-switch-between-nfd-and-nfc:
  t3910: show failure of core.precomposeunicode with decomposed filenames
Merge branch 'tl/relax-in-poll-emulation'

* tl/relax-in-poll-emulation:
  compat/poll: sleep 1 millisecond to avoid busy wait
Merge branch 'dk/raise-core-deltabasecachelimit'

The `core.deltabasecachelimit` used to default to 16 MiB , but this
proved to be too small, and has been bumped to 96 MiB.

* dk/raise-core-deltabasecachelimit:
  Bump core.deltaBaseCacheLimit to 96m
Merge branch 'jk/squelch-compiler-warning-from-funny-error-macro'

* jk/squelch-compiler-warning-from-funny-error-macro:
  let clang use the constant-return error() macro
  inline constant return from error() function
Merge branch 'fc/status-printf-squelch-format-zero-length-warnings'

* fc/status-printf-squelch-format-zero-length-warnings:
  silence a bunch of format-zero-length warnings
Merge branch 'jk/grep-tell-run-command-to-cd-when-running-pager'

* jk/grep-tell-run-command-to-cd-when-running-pager:
  grep: use run-command's "dir" option for --open-files-in-pager