sha1_name.c: indentation fix

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c: clarify what "fake" is for in find_short_object_filename()

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c: rename "now" to "current"

This variable points at the element we are currently looking at, and
does not have anything to do with the current time which the name
"now" implies.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c: refactor find_short_packed_object()

Extract the logic to find object(s) that match a given prefix inside
a single pack into a separate helper function, and give it a bit more
comment.

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

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

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>
sha1_name: do not trigger detailed diagnosis for file arguments

diagnose_invalid_sha1_path() is meant to be called to diagnose a
misspelt <treeish>:<pathname> when <pathname> does not exist in
<treeish>.  However, the code may call it if <treeish>:<pathname> is
invalid (which triggers another call with only_to_die == 1), but for
another reason. This happens when calling e.g.

  git log existing-file HEAD:existing-file

because existing-file is a path and not a revision, the code
verifies that the arguments that follow to be paths.  This leads to
an incorrect message like "existing-file does not exist in HEAD",
even though the path exists in HEAD.

Check that the search for <pathname> in <treeish> fails before
triggering the diagnosis.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
verify_filename(): ask the caller to chose the kind of diagnosis

verify_filename() can be called in two different contexts. Either we
just tried to interpret a string as an object name, and it fails, so
we try looking for a working tree file (i.e. we finished looking at
revs that come earlier on the command line, and the next argument
must be a pathname), or we _know_ that we are looking for a
pathname, and shouldn't even try interpreting the string as an
object name.

For example, with this change, we get:

  $ git log COPYING HEAD:inexistant
  fatal: HEAD:inexistant: no such path in the working tree.
  Use '-- <path>...' to specify paths that do not exist locally.
  $ git log HEAD:inexistant
  fatal: Path 'inexistant' does not exist in 'HEAD'

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 after 1.7.11.

# 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 after 1.7.11.

# 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 after 1.7.11.

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 after 1.7.11.

# 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 after 1.7.11.

# 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 after 1.7.11.

# 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 after 1.7.11.

# By Rüdiger Sonderfeld
* rs/git-blame-mapcar-mapc:
  git-blame.el: use mapc instead of mapcar
Merge branch 'hv/submodule-checkout-nuke-submodules' into jch

Will merge to next after 1.7.11.

# By Heiko Voigt
* hv/submodule-checkout-nuke-submodules:
  update-index: allow overwriting existing submodule index entries
Merge branch 'jc/ustar-checksum-is-unsigned' into jch

Will merge to next after 1.7.11.

* jc/ustar-checksum-is-unsigned:
  archive: ustar header checksum is computed unsigned