implement submodule config cache for lookup of submodule names

This submodule configuration cache allows us to lazily read .gitmodules
configurations by commit into a runtime cache which can then be used to
easily lookup values from it. Currently only the values for path or name
are stored but it can be extended for any value needed.

It is expected that .gitmodules files do not change often between
commits. Thats why we lookup the .gitmodules sha1 from a commit and then
either lookup an already parsed configuration or parse and cache an
unknown one for each sha1. The cache is lazily build on demand for each
requested commit.

This cache can be used for all purposes which need knowledge about
submodule configurations. Example use cases are:

 * Recursive submodule checkout needs lookup a submodule name from its
   path when a submodule first appears. This needs be done before this
   configuration exists in the worktree.

 * The implementation of submodule support for 'git archive' needs to
   lookup the submodule name to generate the archive when given a
   revision that is not checked out.

 * 'git fetch' when given the --recurse-submodules=on-demand option (or
   configuration) needs to lookup submodule names by path from the
   database rather than reading from the worktree. For new submodule it
   needs to lookup the name from its path to allow cloning new
   submodules into the .git folder so they can be checked out without
   any network interaction when the user does a checkout of that
   revision.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
extract functions for submodule config set and lookup

This is one step towards using the new configuration API. We just
extract these functions to make replacing the actual code easier.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
use new config API for worktree configurations of submodules

We remove the extracted functions and directly parse into and read out
of the cache. This allows us to have one unified way of accessing
submodule configuration values specific to single submodules. Regardless
whether we need to access a configuration from history or from the
worktree.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
do not die on error of parsing fetchrecursesubmodules option

We should not die when reading the submodule config cache since the user
might not be able to get out of that situation when the configuration is
part of the history.

We should handle this condition later when the value is about to be
used.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'rs/clean-menu-item-defn' into maint

* rs/clean-menu-item-defn:
  clean: use f(void) instead of f() to declare a pointer to a function without arguments
Sync with maint

* maint:
Merge branch 'jc/clone-borrow' into jch

Allow "git clone --reference" to be used more safely.

* jc/clone-borrow:
  clone: --dissociate option to mark that reference is only temporary
Merge branch 'jc/checkout-local-track-report' into jch

The report from "git checkout" on a branch that builds on another
local branch by setting its branch.*.merge to branch name (not a
full refname) incorrectly said that the upstream is gone.

* jc/checkout-local-track-report:
  checkout: report upstream correctly even with loosely defined branch.*.merge
Merge branch 'jc/diff-b-m' into jch

Fix long-standing bug in "diff -B -M" output.

* jc/diff-b-m:
  diff -B -M: fix output for "copy and then rewrite" case
Merge branch 'jc/strbuf-add-lines-avoid-sp-ht-sequence' into jch

The commented output used to blindly add a SP before the payload
line, resulting in "# \t<indented text>\n" when the payload began
with a HT.  Instead, produce "#\t<indented text>\n".

* jc/strbuf-add-lines-avoid-sp-ht-sequence:
  strbuf_add_commented_lines(): avoid SP-HT sequence in commented lines
Merge branch 'jc/conflict-hint' into jch

Unlike all the other hints given in the commit log editor, the list
of conflicted paths were appended at the end without commented out.

* jc/conflict-hint:
  merge & sequencer: turn "Conflicts:" hint into a comment
  builtin/commit.c: extract ignore_non_trailer() helper function
  merge & sequencer: unify codepaths that write "Conflicts:" hint
  builtin/merge.c: drop a parameter that is never used
Merge branch 'nd/lockfile-absolute' into jch

The lockfile API can get confused which file to clean up when the
process moved the $cwd after creating a lockfile.

* nd/lockfile-absolute:
  lockfile.c: store absolute path
Merge branch 'jc/merge-bases' into jch

* jc/merge-bases:
  get_merge_bases(): always clean-up object flags
  bisect: clean flags after checking merge bases
Merge branch 'jk/fetch-reflog-df-conflict' into jch

Corner-case bugfixes for "git fetch" around reflog handling.

* jk/fetch-reflog-df-conflict:
  t1410: fix breakage on case-insensitive filesystems
### match next
Merge branch 'rs/ref-transaction-reflog' into jch

Reviews and comments?

* rs/ref-transaction-reflog:
  refs.c: allow deleting refs with a broken sha1
  refs.c: remove lock_any_ref_for_update
  refs.c: make unlock_ref/close_ref/commit_ref static
  refs.c: rename log_ref_setup to create_reflog
  reflog.c: use a reflog transaction when writing during expire
  refs.c: allow multiple reflog updates during a single transaction
  refs.c: only write reflog update if msg is non-NULL
  refs.c: add a flag to allow reflog updates to truncate the log
  refs.c: add a transaction function to append a reflog entry
  copy.c: make copy_fd preserve meaningful errno
  refs.c: add a function to append a reflog entry to a fd
  refs.c: add a new update_type field to ref_update
  refs.c: rename the transaction functions
  refs.c: make ref_transaction_delete a wrapper for ref_transaction_update
  refs.c make ref_transaction_create a wrapper to ref_transaction_update
Merge branch 'ms/submodule-update-config-doc' into jch

* ms/submodule-update-config-doc:
  submodule: clarify documentation for update subcommand
Merge branch 'jc/doc-commit-only' into jch

* jc/doc-commit-only:
  Documentation/git-commit: clarify that --only/--include records the working tree contents
Merge branch 'cc/interpret-trailers' into jch

* cc/interpret-trailers:
  trailer: display a trailer without its trailing newline
  trailer: ignore comment lines inside the trailers
Merge branch 'tq/git-ssh-command' into jch

* tq/git-ssh-command:
  git_connect: set ssh shell command in GIT_SSH_COMMAND