Merge branch 'nd/diff-quiet-stat-dirty'

"git diff --quiet -- pathspec1 pathspec2" sometimes did not return
correct status value.

* nd/diff-quiet-stat-dirty:
  diff: do not quit early on stat-dirty files
  diff.c: move diffcore_skip_stat_unmatch core logic out for reuse later
Merge branch 'ds/rev-parse-required-args'

"git rev-parse --default" without the required option argument did
not diagnose it as an error.

* ds/rev-parse-required-args:
  rev-parse: check i before using argv[i] against argc
Merge branch 'jk/config-path-include-fix'

include.path variable (or any variable that expects a path that can
use ~username expansion) in the configuration file is not a
boolean, but the code failed to check it.

* jk/config-path-include-fix:
  handle_path_include: don't look at NULL value
  expand_user_path: do not look at NULL path
Merge branch 'bs/stdio-undef-before-redef'

When we replace broken macros from stdio.h in git-compat-util.h,
preprocessor.

* bs/stdio-undef-before-redef:
  git-compat-util.h: #undef (v)snprintf before #define them
Merge branch 'ep/varscope'

Shrink lifetime of variables by moving their definitions to an
inner scope where appropriate.

* ep/varscope:
  builtin/gc.c: reduce scope of variables
  builtin/fetch.c: reduce scope of variable
  builtin/commit.c: reduce scope of variables
  builtin/clean.c: reduce scope of variable
  builtin/blame.c: reduce scope of variables
  builtin/apply.c: reduce scope of variables
  bisect.c: reduce scope of variable
Merge branch 'wk/submodule-on-branch'

Make sure 'submodule update' modes that do not detach HEADs can
be used more pleasantly by checking out a concrete branch when
cloning them to prime the well.

* wk/submodule-on-branch:
  Documentation: describe 'submodule update --remote' use case
  submodule: explicit local branch creation in module_clone
  submodule: document module_clone arguments in comments
  submodule: make 'checkout' update_module mode more explicit
Merge branch 'nd/test-rename-reset'

* nd/test-rename-reset:
  t7101, t7014: rename test files to indicate what that file is for
Merge branch 'mw/symlinks'

All subcommands that take pathspecs mishandled an in-tree symbolic
link when given it as a full path from the root (which arguably is
a sick way to use pathspecs).  "git ls-files -s $(pwd)/RelNotes" in
our tree is an easy reproduction recipe.

* mw/symlinks:
  setup: don't dereference in-tree symlinks for absolute paths
  setup: add abspath_part_inside_repo() function
  t0060: add tests for prefix_path when path begins with work tree
  t0060: add test for prefix_path when path == work tree
  t0060: add test for prefix_path on symlinks via absolute paths
  t3004: add test for ls-files on symlinks via absolute paths
Merge branch 'ks/tree-diff-walk'

* ks/tree-diff-walk:
  tree-walk: finally switch over tree descriptors to contain a pre-parsed entry
  revision: convert to using diff_tree_sha1()
  line-log: convert to using diff_tree_sha1()
  tree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL
  tree-diff: allow diff_tree_sha1 to accept NULL sha1
Merge branch 'nd/reset-intent-to-add'

* nd/reset-intent-to-add:
  reset: support "--mixed --intent-to-add" mode
Merge branch 'jk/test-ports'

Avoid having to assign port number to be used in tests manually.

* jk/test-ports:
  tests: auto-set git-daemon port
  tests: auto-set LIB_HTTPD_PORT from test name
Merge branch 'al/docs'

A handful of documentation updates, all trivially harmless.

* al/docs:
  docs/git-blame: explain more clearly the example pickaxe use
  docs/git-clone: clarify use of --no-hardlinks option
  docs/git-remote: capitalize first word of initial blurb
  docs/merge-strategies: remove hyphen from mis-merges
Merge branch 'bc/gpg-sign-everywhere'

Teach "--gpg-sign" option to many commands that create commits.

* bc/gpg-sign-everywhere:
  pull: add the --gpg-sign option.
  rebase: add the --gpg-sign option
  rebase: parse options in stuck-long mode
  rebase: don't try to match -M option
  rebase: remove useless arguments check
  am: add the --gpg-sign option
  am: parse options in stuck-long mode
  git-sh-setup.sh: add variable to use the stuck-long mode
  cherry-pick, revert: add the --gpg-sign option
Merge branch 'dk/blame-janitorial'

Code clean-up.

* dk/blame-janitorial:
  builtin/blame.c::find_copy_in_blob: no need to scan for region end
  blame.c: prepare_lines should not call xrealloc for every line
  builtin/blame.c::prepare_lines: fix allocation size of sb->lineno
  builtin/blame.c: eliminate same_suspect()
  builtin/blame.c: struct blame_entry does not need a prev link
Merge branch 'jk/pack-bitmap'

Borrow the bitmap index into packfiles from JGit to speed up
enumeration of objects involved in a commit range without having to
fully traverse the history.

* jk/pack-bitmap: (26 commits)
  ewah: unconditionally ntohll ewah data
  ewah: support platforms that require aligned reads
  read-cache: use get_be32 instead of hand-rolled ntoh_l
  block-sha1: factor out get_be and put_be wrappers
  do not discard revindex when re-preparing packfiles
  pack-bitmap: implement optional name_hash cache
  t/perf: add tests for pack bitmaps
  t: add basic bitmap functionality tests
  count-objects: recognize .bitmap in garbage-checking
  repack: consider bitmaps when performing repacks
  repack: handle optional files created by pack-objects
  repack: turn exts array into array-of-struct
  repack: stop using magic number for ARRAY_SIZE(exts)
  pack-objects: implement bitmap writing
  rev-list: add bitmap mode to speed up object lists
  pack-objects: use bitmaps when packing objects
  pack-objects: split add_object_entry
  pack-bitmap: add support for bitmap indexes
  documentation: add documentation for the bitmap format
  ewah: compressed bitmap implementation
  ...
Merge branch 'nd/http-fetch-shallow-fix'

Attempting to deepen a shallow repository by fetching over smart
HTTP transport failed in the protocol exchange, when no-done
extension was used.  The fetching side waited for the list of
shallow boundary commits after the sending end stopped talking to
it.

* nd/http-fetch-shallow-fix:
  t5537: move http tests out to t5539
  fetch-pack: fix deepen shallow over smart http with no-done cap
  protocol-capabilities.txt: document no-done
  protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txt
  pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done'
  test: rename http fetch and push test files
tag: support --sort=<spec>

--sort=version:refname (or --sort=v:refname for short) sorts tags as
if they are versions. --sort=-refname reverses the order (with or
without ":version").

versioncmp() is copied from string/strverscmp.c in glibc commit
ee9247c38a8def24a59eb5cfb7196a98bef8cfdc, reformatted to Git coding
style. The implementation is under LGPL-2.1 and according to [1] I can
relicense it to GPLv2.

[1] http://www.gnu.org/licenses/gpl-faq.html#AllCompatibility

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
docs: clarify remote restrictions for git-upload-archive

Commits ee27ca4 and 0f544ee introduced rules by which
git-upload-archive would restrict clients from accessing
unreachable objects. However, we never documented those
rules anywhere, nor their reason for being. Let's do so now.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
add uploadarchive.allowUnreachable option

In commit ee27ca4, we started restricting remote git-archive
invocations to only accessing reachable commits. This
matches what upload-pack allows, but does restrict some
useful cases (e.g., HEAD:foo). We loosened this in 0f544ee,
which allows `foo:bar` as long as `foo` is a ref tip.
However, that still doesn't allow many useful things, like:

  1. Commits accessible from a ref, like `foo^:bar`, which
     are reachable

  2. Arbitrary sha1s, even if they are reachable.

We can do a full object-reachability check for these cases,
but it can be quite expensive if the client has sent us the
sha1 of a tree; we have to visit every sub-tree of every
commit in the worst case.

Let's instead give site admins an escape hatch, in case they
prefer the more liberal behavior.  For many sites, the full
object database is public anyway (e.g., if you allow dumb
walker access), or the site admin may simply decide the
security/convenience tradeoff is not worth it.

This patch adds a new config option to disable the
restrictions added in ee27ca4. It defaults to off, meaning
there is no change in behavior by default.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch: add a failing test for prunning with overlapping refspecs

When a remote has multiple fetch refspecs and these overlap in the
target namespace, fetch may prune a remote-tracking branch which still
exists in the remote. The test uses a popular form of this, by putting
pull requests as stored in a popular hosting platform alongside "real"
remote-tracking branches.

The fetch command makes a decision of whether to prune based
on the first matching refspec, which in this case is insufficient, as it
covers the pull request names. This pair of refspecs does work as
expected if the more "specific" refspec is the first in the list.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>