sha1_name.c: correct misnamed "canonical" and "res"

These are hexadecimal and binary representation of the short object
name given to the callchain as its input.  Rename them with _pfx
suffix to make it clear they are prefixes, and call them hex and bin
respectively.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c: restructure disambiguation of short names

We try to find zero, one or more matches from loose objects and
packed objects independently and then decide if the given short
object name is unique across them.

Instead, introduce a "struct disambiguate_state" that keeps track of
what we have found so far, that can be one of:

 - We have seen one object that _could_ be what we are looking for;
 - We have also checked that object for additional constraints (if any),
   and found that the object satisfies it;
 - We have also checked that object for additional constraints (if any),
   and found that the object does not satisfy it; or
 - We have seen more than one objects that satisfy the constraints.

and pass it to the enumeration functions for loose and packed
objects.  The disambiguation state can optionally take a callback
function that takes a candidate object name and reports if the
object satisifies additional criteria (e.g. when the caller knows
that the short name must refer to a commit, this mechanism can be
used to check the type of the given object).

Compared to the earlier attempt, this round avoids the optional
check if there is only one candidate that matches the short name in
the first place.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c: allow get_short_sha1() to take other flags

Instead of a separate "int quietly" argument, make it take "unsigned flags"
so that we can pass other options to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c: teach get_short_sha1() a commit-only option

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c: get_describe_name() by definition groks only commits

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jk/version-string' into jch

Originally merged to 'next' on 2012-06-05.

Teaches git native protocol agents to show software version over the
wire.

Will merge to 'master'.

# By Jeff King
* jk/version-string:
  http: get default user-agent from git_user_agent
  version: add git_user_agent function
  move git_version_string into version.c
Merge branch 'jk/clone-local' into jch

Originally merged to 'next' on 2012-06-05.

"git clone --local $path" started its life as an experiment to
optionally use link/copy when cloning a repository on the disk, but
we didn't deprecate it after we made the option a no-op to always
use the optimization.

Will merge to 'master'.

# By Jeff King
* jk/clone-local:
  clone: allow --no-local to turn off local optimizations
  docs/clone: mention that --local may be ignored
Merge branch 'jk/no-more-asciidoc7' into jch

Originally merged to 'next' on 2012-06-05.

We no longer use AsciiDoc7 syntax in our documentation and favor a
more modern style.

Will merge to 'master'.

# By Jeff King
* jk/no-more-asciidoc7:
  docs: drop antique comment from Makefile
  docs: drop asciidoc7compatible flag
Merge branch 'jc/request-pull-match-tagname' into jch

Originally merged to 'next' on 2012-06-05.

"git request-pull $url dev" when the tip of "dev" branch was tagged
with "ext4-for-linus" used the contents from the tag in the output
but still asked the "dev" branch to be pulled, not the tag.

Will merge to 'master'.

* jc/request-pull-match-tagname:
  request-pull: really favor a matching tag
Merge branch 'jc/bundle-complete-notice' into jch

Originally merged to 'next' on 2012-06-04.

Running "git bundle verify" on a bundle that records a complete
history said "it requires these 0 commits".

Will merge to 'master'.

* jc/bundle-complete-notice:
  tweak "bundle verify" of a complete history
Merge branch 'vr/help-per-platform' into jch

Originally merged to 'next' on 2012-06-08

We used to always default to "man" format even on platforms where
"man" viewer is not widely available.

Will merge to 'master'.

* vr/help-per-platform:
  help: use HTML as the default help format on Windows

Conflicts:
	Makefile
Merge branch 'jk/maint-t1304-setfacl' into jch

Originally merged to 'next' on 2012-06-08.

Works around a false test failure caused by a bug in ecryptofs.

Will merge to 'master'.

# By Jeff King
* jk/maint-t1304-setfacl:
  t1304: improve setfacl prerequisite setup
Merge branch 'jc/ls-files-i-dir' into jch

Originally merged to 'next' on 2012-06-08.

"git ls-files --exclude=t -i" did not consider anything under t/
as excluded, as it did not pay attention to exclusion of leading
paths while walking the index.  Other two users of excluded() are
also updated.

Will merge to 'master'.

* jc/ls-files-i-dir:
  dir.c: make excluded() file scope static
  unpack-trees.c: use path_excluded() in check_ok_to_remove()
  builtin/add.c: use path_excluded()
  path_excluded(): update API to less cache-entry centric
  ls-files -i: micro-optimize path_excluded()
  ls-files -i: pay attention to exclusion of leading paths
Merge branch 'nd/stream-index-pack' into jch

Use streaming API to read from the object store to avoid having to hold
a large blob object in-core while running index-pack.

Will merge to 'next'.

# By Nguyễn Thái Ngọc Duy
* nd/stream-index-pack:
  index-pack: use streaming interface for collision test on large blobs
  index-pack: factor out unpack core from get_data_from_pack
  index-pack: use streaming interface on large blobs (most of the time)
  index-pack: hash non-delta objects while reading from stream
Merge branch 'nd/stream-pack-objects' into jch

Will merge to 'next'.

# By Nguyễn Thái Ngọc Duy
* nd/stream-pack-objects:
  pack-objects: use streaming interface for reading large loose blobs
Merge branch 'mm/push-default-switch-warning' into jch

Will merge to 'next'.

Hopwefully we can have a solidly tested series early in 1.7.12 or
1.7.13 at the latest.

# By Matthieu Moy
* mm/push-default-switch-warning:
  push: start warning upcoming default change for push.default
Merge branch 'nd/i18n-branch-lego' into jch

Restructure the way message strings are created, in preparation for
marking them for i18n.

Will merge to 'next' and soon to 'master'.

# By Nguyễn Thái Ngọc Duy
* nd/i18n-branch-lego:
  Remove i18n legos in notifying new branch tracking setup
Merge branch 'nd/i18n-misc' into jch

Restructure the way message strings are created, in preparation for
marking them for i18n.

Will merge to 'next' and soon to 'master'.

# By Nguyễn Thái Ngọc Duy
* nd/i18n-misc:
  rerere: remove i18n legos in result message
  notes-merge: remove i18n legos in merge result message
  reflog: remove i18n legos in pruning message
Merge branch 'rr/doc-commit' into jch

Will merge to 'next' and soon to 'master'.

# By Ramkumar Ramachandra
* rr/doc-commit:
  commit: document a couple of options
Merge branch 'rs/git-blame-mapcar-mapc' into jch

Will merge to 'next' and soon to 'master'.

# By Rüdiger Sonderfeld
* rs/git-blame-mapcar-mapc:
  git-blame.el: use mapc instead of mapcar