t9300-fast-import: avoid 'exit' in test_expect_success snippets

Exiting from a for-loop early using '|| break' does not propagate the
failure code, and for this reason, the tests used just 'exit'. But this
ends the test script with 'FATAL: Unexpected exit code 1' in the case of
a failed test.

Fix this by moving the loop into a shell function, from which we can
simply return early.

While at it, modernize the style of the affected test cases.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation: explain push.default option a bit more

The previous documentation was explaining _what_ the options were doing,
but were of little help explaining _why_ a user should set his default to
either of the options.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
push: introduce new push.default mode "simple"

When calling "git push" without argument, we want to allow Git to do
something simple to explain and safe. push.default=matching is unsafe
when use to push to shared repositories, and hard to explain to beginners
in some context. It is debatable whether 'upstream' or 'current' is the
safest or the easiest to explain, so introduce a new mode called 'simple'
that is the intersection of them: push the upstream branch, but only if
it has the same name remotely. If not, give an error that suggest the
right command to push explicitely to 'upstream' or 'current'.

A question is whether to allow pushing when no upstream is configured. An
argument in favor of allowing the push is that it makes the new mode work
in more cases. On the other hand, refusing to push when no upstream is
configured encourages the user to set the upstream, which will be
beneficial on the next pull. Lacking better argument, we chose to deny
the push, because it will be easier to change in the future is someone
shows us wrong.

Original-patch-by: Jeff King <peff@peff.net>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t5570: use explicit push refspec

The default mode for push without arguments will change. Some warnings
are about to be enabled for such use, which causes some t5570 tests to
fail because they do not expect this output.

Fix this by passing an explicit refspec to git push. To that end, change
the calling conventions of test_remote_error in order to accomodate
extra command arguments.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
push: start warning upcoming default change for push.default

In preparation for flipping the default to the "simple" mode from
the "matching" mode that is the historical default, start warning
users when they rely on unconfigured "git push" to default to the
"matching" mode.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'lp/maint-diff-three-dash-with-graph' into jch

Will merge to 'next'.

By Lucian Poston
* lp/maint-diff-three-dash-with-graph:
  t4202: add test for "log --graph --stat -p" separator lines
  log --graph: fix break in graph lines
  log --graph --stat: three-dash separator should come after graph lines
Merge branch 'hv/submodule-recurse-push' into jch

Will merge to 'next'.

By Heiko Voigt
* hv/submodule-recurse-push:
  push: teach --recurse-submodules the on-demand option
  Refactor submodule push check to use string list instead of integer
  Teach revision walking machinery to walk multiple times sequencially

Conflicts:
	transport.h
Merge branch 'mh/ref-api' into jch

Allows walking only a sub-hierarchy in refs/*.

Will merge to 'next'.

By Michael Haggerty
* mh/ref-api:
  do_for_each_ref(): only iterate over the subtree that was requested
  refs: store references hierarchically
  sort_ref_dir(): simplify logic
  refs.c: rename ref_array -> ref_dir
  struct ref_entry: nest the value part in a union
  check_refname_component(): return 0 for zero-length components
  free_ref_entry(): new function
  names_conflict(): simplify implementation
  repack_without_ref(): reimplement using do_for_each_ref_in_array()
  do_for_each_ref_in_arrays(): new function
  do_for_each_ref_in_array(): new function
  refs: manage current_ref within do_one_ref()
  refs.c: reorder definitions more logically
Merge branch 'pw/fast-import-dataref-parsing' into jch

Will merge to 'next'.

By Pete Wyckoff
* pw/fast-import-dataref-parsing:
  fast-import: tighten parsing of datarefs
Merge branch 'it/fetch-pack-many-refs' into jch

Will merge to 'next'.

By Ivan Todoroski
* it/fetch-pack-many-refs:
  remote-curl: main test case for the OS command line overflow
  fetch-pack: test cases for the new --stdin option
  remote-curl: send the refs to fetch-pack on stdin
  fetch-pack: new --stdin option to read refs from stdin

Conflicts:
	t/t5500-fetch-pack.sh
Merge branch 'jc/maint-blame-minimal' into jch

"git blame" started missing quite a few changes from the origin since we
stopped using the diff minimalization by default in v1.7.2 era.

Will merge to 'next'.

* jc/maint-blame-minimal:
  blame: accept --need-minimal
Merge branch 'mk/gitweb-diff-hl' into jch

Will merge to 'next'.

By Michał Kiedrowicz (7) and Jakub Narębski (1)
* mk/gitweb-diff-hl:
  gitweb: Refinement highlightning in combined diffs
  gitweb: Highlight interesting parts of diff
  gitweb: Push formatting diff lines to print_diff_chunk()
  gitweb: Use print_diff_chunk() for both side-by-side and inline diffs
  gitweb: Extract print_sidebyside_diff_lines()
  gitweb: Pass esc_html_hl_regions() options to esc_html()
  gitweb: esc_html_hl_regions(): Don't create empty <span> elements
  gitweb: Use descriptive names in esc_html_hl_regions()
Merge branch 'jl/maint-submodule-recurse-fetch' into jch

Will merge to 'next'.

By Jens Lehmann
* jl/maint-submodule-recurse-fetch:
  submodules: recursive fetch also checks new tags for submodule commits
Merge branch 'jn/more-i18ncmp' into jch

Will merge to 'next'.

By Jonathan Nieder
* jn/more-i18ncmp:
  test: am of empty patch should not succeed
  test: use test_i18ncmp for "Patch format detection failed" message
  test: do not rely on US English tracking-info messages
Merge branch 'jn/fast-import-doc' into jch

Will merge to 'next'.

By Jonathan Nieder
* jn/fast-import-doc:
  fast-import doc: cat-blob and ls responses need to be consumed quickly
Merge branch 'zj/upstream-error-message' into jch

Will merge to 'next'.

By Zbigniew Jędrzejewski-Szmek
* zj/upstream-error-message:
  i18n: mark @{upstream} error messages for translation
  Be more specific if upstream branch is not tracked
  Provide better message for barnhc_wiht_tpyo@{u}
  Provide branch name in error message when using @{u}
  t1507: add tests to document @{upstream} behaviour
Merge branch 'jm/maint-strncpy-diff-no-index' into jch

Will merge to 'next'.

By Jim Meyering
* jm/maint-strncpy-diff-no-index:
  diff: avoid stack-buffer-read-overrun for very long name
Merge branch 'bw/test-fix-grep-gnuism' into jch

Fix two places that were the only place in the test suite that gave "a\+"
to platform grep and expected it to mean one or more "a", which is a
blatant GNUism.

Will merge to 'next'.

* bw/test-fix-grep-gnuism:
  t9400: fix gnuism in grep
Merge branch 'mb/fetch-call-a-non-branch-a-ref' into jch

Replacement to use the origin side to paint the message broke badly.

By Marc Branchaud
* mb/fetch-call-a-non-branch-a-ref:
  fetch: describe new refs based on where it came from
  fetch: Give remote_ref to update_local_ref() as well

Conflicts:
	builtin/fetch.c
Merge branch 'rj/mingw-isguid' into jch

By Ramsay Jones
* rj/mingw-isguid:
  compat/mingw.h: Set S_ISUID to prevent a fast-import test failure