index-pack: use streaming interface for collision test on large blobs

When putting whole objects in core is unavoidable, try match object
type and size first before actually inflating.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'fc/git-complete-helper-fix' into jch

Will merge to master.

By Felipe Contreras
* fc/git-complete-helper-fix:
  completion: add support for backwards compatibility
  completion: rename internal helpers _git and _gitk
Merge branch 'jk/ident-split-fix' into jch

An author/committer name that is a single character was mishandled as an
invalid name by mistake.

Will merge to master and later to maint.

By Jeff King
* jk/ident-split-fix:
  fix off-by-one error in split_ident_line
Merge branch 'rs/maint-grep-F' into jch

"git grep -e '$pattern'", unlike the case where the patterns are read from
a file, did not treat individual lines in the given pattern argument as
separate regular expressions as it should.

Will merge to master and later to maint.

By René Scharfe
* rs/maint-grep-F:
  grep: stop leaking line strings with -f
  grep: support newline separated pattern list
  grep: factor out do_append_grep_pat()
  grep: factor out create_grep_pat()
Merge branch 'sp/sh-windows-pwd' into jch

Will merge to master.

* sp/sh-windows-pwd:
  git-sh-setup: define workaround wrappers before they are used
Merge branch 'jk/ident-gecos-strbuf' into jch

Fixes quite a lot of brokenness when ident information needs to be taken
from the system and cleans up the code.

Will merge to master.

By Jeff King
* jk/ident-gecos-strbuf: (22 commits)
  format-patch: do not use bogus email addresses in message ids
  ident: reject bogus email addresses with IDENT_STRICT
  ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT
  format-patch: use GIT_COMMITTER_EMAIL in message ids
  ident: let callers omit name with fmt_indent
  ident: refactor NO_DATE flag in fmt_ident
  ident: reword empty ident error message
  format-patch: refactor get_patch_filename
  ident: trim whitespace from default name/email
  ident: use a dynamic strbuf in fmt_ident
  ident: use full dns names to generate email addresses
  ident: report passwd errors with a more friendly message
  drop length limitations on gecos-derived names and emails
  ident: don't write fallback username into git_default_name
  fmt_ident: drop IDENT_WARN_ON_NO_NAME code
  format-patch: use default email for generating message ids
  ident: trim trailing newline from /etc/mailname
  move git_default_* variables to ident.c
  move identity config parsing to ident.c
  fmt-merge-msg: don't use static buffer in record_person
  ...
Merge branch 'rs/xdiff-fast-hash-fix' into jch

Will merge to master.

By René Scharfe
* rs/xdiff-fast-hash-fix:
  xdiff: import new 32-bit version of count_masked_bytes()
  xdiff: avoid more compiler warnings with XDL_FAST_HASH on 32-bit machines
  xdiff: avoid compiler warnings with XDL_FAST_HASH on 32-bit machines
Merge branch 'rs/dir-strbuf-read-recursive-fix' into jch

Will merge to master.

By René Scharfe
* rs/dir-strbuf-read-recursive-fix:
  dir: simplify fill_directory()
  dir: respect string length argument of read_directory_recursive()
Merge branch 'rs/refs-string-slice' into jch

Avoid unnecessary temporary allocations while looking for matching refs
inside refs API.

By René Scharfe (3) and Junio C Hamano (1)
* rs/refs-string-slice:
  refs: do not create ref_entry when searching
  refs: use strings directly in find_containing_dir()
  refs: convert parameter of create_dir_entry() to length-limited string
  refs: convert parameter of search_ref_dir() to length-limited string
Merge branch 'jk/fetch-pack-remove-dups-optim' into jch

The way "fetch-pack" that is given multiple references to fetch tried to
remove duplicates was very inefficient.

Will merge to master.

By Jeff King
* jk/fetch-pack-remove-dups-optim:
  fetch-pack: sort incoming heads list earlier
  fetch-pack: avoid quadratic loop in filter_refs
  fetch-pack: sort the list of incoming refs
  add sorting infrastructure for list refs
  fetch-pack: avoid quadratic behavior in remove_duplicates
  fetch-pack: sort incoming heads
Merge branch 'mh/ref-api-lazy-loose' into jch

The code to lazily read loose refs by mistake unnecessarily read the refs
in a subhierarchy when we free the data for the subhierarchy.

Will merge to master.

By Michael Haggerty
* mh/ref-api-lazy-loose:
  free_ref_entry(): do not trigger reading of loose refs
Merge branch 'ng/pack-objects-cleanup' into jch

By Nguyễn Thái Ngọc Duy
* ng/pack-objects-cleanup:
  pack-objects: refactor write_object() into helper functions
  pack-objects, streaming: turn "xx >= big_file_threshold" to ".. > .."
Merge branch 'jk/pretty-commit-header-incomplete-line' into jch

Will merge to master and later to maint.

By Jeff King
* jk/pretty-commit-header-incomplete-line:
  avoid segfault when reading header of malformed commits
Merge branch 'jk/format-person-part-buffer-limit' into jch

Will merge to master and later to maint.

By Jeff King
* jk/format-person-part-buffer-limit:
  pretty: avoid buffer overflow in format_person_part
Merge branch 'mh/test-keep-prove-cache' into jch

By Michael Haggerty
* mh/test-keep-prove-cache:
  t/Makefile: retain cache t/.prove across prove runs
Merge branch 'mh/fetch-pack-constness' into jch

Tighten constness of some local variables in a callchain.

By Michael Haggerty
* mh/fetch-pack-constness:
  cmd_fetch_pack(): respect constness of argv parameter
  cmd_fetch_pack(): combine the loop termination conditions
  cmd_fetch_pack(): handle non-option arguments outside of the loop
  cmd_fetch_pack(): declare dest to be const
Merge branch 'ap/checkout-no-progress-for-non-tty' into jch

Will merge to master.

By Avery Pennarun
* ap/checkout-no-progress-for-non-tty:
  checkout: no progress messages if !isatty(2).
Merge branch 'mh/ref-api' into jch

Will merge to master.

By Michael Haggerty
* mh/ref-api:
  Avoid sorting if references are added to ref_cache in order
Merge branch 'nl/http-proxy-more' into pu

I queued only the later two patches from this series, even though they do
not make much sense without the first one that seems to need a bit more
work, so that we won't forget.

By Jeff King (1) and Nelson Benitez Leon (1)
* nl/http-proxy-more:
  http: rename HTTP_REAUTH to HTTP_AUTH_RETRY
  http: Avoid limit of retrying request only twice
Merge branch 'mm/push-default-switch-warning' into pu

Will squash the two, but this has to wait for a few release cycles.

By Junio C Hamano (1) and Matthieu Moy (1)
* mm/push-default-switch-warning:
  t5541: warning message is given even with --quiet
  push: start warning upcoming default change for push.default