gitweb: make remote_heads config setting work

Git configuration items can not contain underscores in their section
and bottom-level variable name; the 'remote_heads' feature can not
be enabled on a per-repository basis with that name.

This changes the git-config option to be `gitweb.remoteheads` but does
not change the gitweb.conf option, to avoid backwards compatibility
issues.  We strip underscores from keys before looking through
git-config output for them.

An existing check on keynames was overly eager to reject non-word
letters, but if we ever start using three-level names, the middle
level string can contain almost anything, so fix that as well while
we are in the vicinity.

Signed-off-by: Phil Pennock <phil@apcera.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'rc/maint-complete-git-p4' into jch

Comment from Pete will need to be addressed in a follow-up patch.

* rc/maint-complete-git-p4:
  Teach git-completion about git p4
Merge branch 'sg/complete-help-undup' into jch

Will merge to 'master' in the seventh batch.

* sg/complete-help-undup:
  completion: remove 'help' duplicate from porcelain commands
Merge branch 'fc/remote-hg' into jch

New remote helper for hg.

Will merge to 'master' in the seventh batch.

* fc/remote-hg:
  remote-hg: avoid bad refs
  remote-hg: try the 'tip' if no checkout present
  remote-hg: fix compatibility with older versions of hg
  remote-hg: add missing config for basic tests
  remote-hg: the author email can be null
  remote-hg: add option to not track branches
  remote-hg: add extra author test
  remote-hg: add tests to compare with hg-git
  remote-hg: add bidirectional tests
  test-lib: avoid full path to store test results
  remote-hg: add basic tests
  remote-hg: fake bookmark when there's none
  remote-hg: add compat for hg-git author fixes
  remote-hg: add support for hg-git compat mode
  remote-hg: match hg merge behavior
  remote-hg: make sure the encoding is correct
  remote-hg: add support to push URLs
  remote-hg: add support for remote pushing
  remote-hg: add support for pushing
  Add new remote-hg transport helper
Merge branch 'fc/remote-bzr' into jch

New remote helper for bzr.

Will merge to 'master' in the seventh batch.

* fc/remote-bzr:
  remote-bzr: update working tree
  remote-bzr: add support for remote repositories
  remote-bzr: add support for pushing
  remote-bzr: add simple tests
  Add new remote-bzr transport helper
Merge branch 'bc/do-not-recurse-in-die' into jch

Will merge to 'master' in the seventh batch.

* bc/do-not-recurse-in-die:
  usage.c: detect recursion in die routines and bail out immediately
Merge branch 'jh/update-ref-d-through-symref' into jch

"update-ref -d --deref SYM" to delete a ref through a symbolic ref
that points to it did not remove it correctly.

Will merge to 'master' in the seventh batch.

* jh/update-ref-d-through-symref:
  Fix failure to delete a packed ref through a symref
  t1400-update-ref: Add test verifying bug with symrefs in delete_ref()
Merge branch 'rr/submodule-diff-config' into jch

Lets "git diff --submodule=log" become the default via configuration.

Will merge to 'master' in the seventh batch.

* rr/submodule-diff-config:
  submodule: display summary header in bold
  diff: rename "set" variable
  diff: introduce diff.submodule configuration variable
  Documentation: move diff.wordRegex from config.txt to diff-config.txt
Merge branch 'mk/complete-tcsh' into jch

Will merge to 'master' in the seventh batch.

* mk/complete-tcsh:
  tcsh-completion re-using git-completion.bash
Merge branch 'lt/diff-stat-show-0-lines' into jch

We failed to mention a file without any content change but whose
permission bit was modified, or (worse yet) a new file without any
content in the "git diff --stat" output.

Will merge to 'master' in the seventh batch.

* lt/diff-stat-show-0-lines:
  Fix "git diff --stat" for interesting - but empty - file changes
Merge branch 'nd/wildmatch' into jch

Allows pathname patterns in .gitignore and .gitattributes files
with double-asterisks "foo/**/bar" to match any number of directory
hierarchies.

I suspect that this needs to be plugged to pathspec matching code;
otherwise "git log -- 'Docum*/**/*.txt'" would not show the log for
commits that touch Documentation/git.txt, which would be confusing
to the users.

Will cook in 'next'.

* nd/wildmatch:
  test-wildmatch: avoid Windows path mangling
  Support "**" wildcard in .gitignore and .gitattributes
  wildmatch: make /**/ match zero or more directories
  wildmatch: adjust "**" behavior
  wildmatch: fix case-insensitive matching
  wildmatch: remove static variable force_lower_case
  wildmatch: make wildmatch's return value compatible with fnmatch
  t3070: disable unreliable fnmatch tests
  Integrate wildmatch to git
  wildmatch: follow Git's coding convention
  wildmatch: remove unnecessary functions
  Import wildmatch from rsync
  ctype: support iscntrl, ispunct, isxdigit and isprint
  ctype: make sane_ctype[] const array

Conflicts:
	Makefile
Merge branch 'nd/maint-compat-fnmatch-fix' into jch

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

* nd/maint-compat-fnmatch-fix:
  compat/fnmatch: fix off-by-one character class's length check
Merge branch 'jc/apply-trailing-blank-removal' into jch

Fix to update_pre_post_images() that did not take into account the
possibility that whitespace fix could shrink the preimage and
change the number of lines in it.

Will merge to 'next'.

* jc/apply-trailing-blank-removal:
  apply.c:update_pre_post_images(): the preimage can be truncated
Merge branch 'jk/pickaxe-textconv' into jch

Use textconv filters when searching with "log -S".

Will merge to 'next'.

* jk/pickaxe-textconv:
  pickaxe: use textconv for -S counting
  pickaxe: hoist empty needle check
Merge branch 'mm/status-push-pull-advise' into jch

Will merge to 'next'.

* mm/status-push-pull-advise:
  status: add advice on how to push/pull to tracking branch
Merge branch 'mh/ceiling' into jch

Elements of GIT_CEILING_DIRECTORIES list may not match the real
pathname we obtain from getcwd(), leading the GIT_DIR discovery
logic to escape the ceilings the user thought to have specified.

* mh/ceiling:
  string_list_longest_prefix(): remove function
  setup_git_directory_gently_1(): resolve symlinks in ceiling paths
  longest_ancestor_length(): require prefix list entries to be normalized
  longest_ancestor_length(): take a string_list argument for prefixes
  longest_ancestor_length(): use string_list_split()
  Introduce new function real_path_if_valid()
  real_path_internal(): add comment explaining use of cwd
  Introduce new static function real_path_internal()

Conflicts:
	Documentation/technical/api-string-list.txt
	string-list.c
	string-list.h
Merge branch 'mk/maint-graph-infinity-loop' into jch

The --graph code fell into infinite loop when asked to do what the
code did not expect ;-)

Anybody who worked on "--graph" wants to comment?
Stalled mostly due to lack of responses.

* mk/maint-graph-infinity-loop:
  graph.c: infinite loop in git whatchanged --graph -m
Merge branch 'fc/zsh-completion' into jch

Replaced by shedding large changes to other independent topics.
Any comments from zsh users?

* fc/zsh-completion:
  completion: start moving to the new zsh completion
  completion: add new zsh completion
Merge branch 'fc/remote-testgit-feature-done' into jch

Is this still in "Needs review" state?  Are people involved in the
remote interface happy with this change?

* fc/remote-testgit-feature-done:
  remote-testgit: properly check for errors
Merge branch 'fc/completion-test-simplification' into jch

Clean up completion tests.  Use of conslidated helper may make
instrumenting one particular test during debugging of the test
itself, but I think that issue should be addressed in some other
way (e.g. making sure individual tests in 9902 can be skipped).

* fc/completion-test-simplification:
  completion: simplify __gitcomp() test helper
  completion: refactor __gitcomp related tests
  completion: consolidate test_completion*() tests
  completion: simplify tests using test_completion_long()
  completion: standardize final space marker in tests
  completion: add comment for test_completion()