parse_fetch_refspec(): clarify the codeflow a bit

Most parts of the cascaded if/else if/... checked an allowable
condition but some checked forbidden conditions.  This makes adding
new allowable conditions unnecessarily inconvenient.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
mergetool--lib: simplify command expressions

Update variable assignments to always use $(command "$arg")
in their RHS instead of "$(command "$arg")" as the latter
is harder to read.  Make get_merge_tool_cmd() simpler by
avoiding "echo" and $(command) substitutions completely.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mergetool--lib: improve the help text in guess_merge_tool()

This code path is only activated when the user does not have a valid
configured tool.  Add a message to guide new users towards configuring a
default tool.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mergetool--lib: add functions for finding available tools

Refactor show_tool_help() so that the tool-finding logic is broken out
into a separate show_tool_names() function.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch: fetch objects by their exact SHA-1 object names

Update "git fetch-pack" and callchain leading from fetch_pack() to
do_fetch_pack(), which did not use struct ref abstraction to pass
what remote refs were requested, and instead passed around a vanilla
string list that does not know anything about what it represents.
Now the callchain uses "struct ref" to record what was requested by
the user.

The above change should be split out to its own commit.

The callchain leading to everything_local() assumed that the set of
remote refs we learned from get_remote_heads() is a superset of
everything we could fetch, and did not consider there may be other
things that is known to the "sought" list to be obtainable.  Correct
this by adding requests to fetch objects by their exact SHA-1 object
names to the real refs the remote has, when the server side advertises
the allow-tip-sha1-in-want capablitiy.

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

Cleans up mergetool/difftool combo.

This is looking ready for 'next'.

* jk/mergetool:
  mergetools: simplify how we handle "vim" and "defaults"
  mergetool--lib: don't call "exit" in setup_tool
  mergetool--lib: improve show_tool_help() output
  mergetools/vim: remove redundant diff command
  git-difftool: use git-mergetool--lib for "--tool-help"
  git-mergetool: don't hardcode 'mergetool' in show_tool_help
  git-mergetool: remove redundant assignment
  git-mergetool: move show_tool_help to mergetool--lib
git-send-email: add ~/.authinfo parsing

Make git-send-email read password from a ~/.authinfo or ~/.netrc file
instead of requiring it to be stored in git configuration, passed as
command line argument or typed in.

There are various other applications that use this file for
authentication information so letting users use it for git-send-email
is convinient.  Furthermore, some users store their ~/.gitconfig file
in a public repository and having to store password there makes it
easy to publish the password.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
CodingGuidelines: add Python coding guidelines

These are kept short by simply deferring to PEP-8.  Most of the Python
code in Git is already very close to this style (some things in contrib/
are not).

Rationale for version suggestions:

 - Amongst the noise in [1], there isn't any disagreement about using
   2.6 as a base (see also [2]), although Brandon Casey recently added
   support for 2.4 and 2.5 to git-p4 [3].

 - Restricting ourselves to 2.6+ makes aiming for Python 3 compatibility
   significantly easier [4].

 - Advocating Python 3 support in all scripts is currently unrealistic
   because:

     - 'p4 -G' provides output in a format that is very hard to use with
       Python 3 (and its documentation claims Python 3 is unsupported).

     - Mercurial does not support Python 3.

     - Bazaar does not support Python 3.

 - But we should try to make new scripts compatible with Python 3
   because all new Python development is happening on version 3 and the
   Python community will eventually stop supporting Python 2 [5].

 - Python 3.1 is required to support the 'surrogateescape' error handler
   for encoding/decodng filenames to/from Unicode strings and Python 3.0
   is not longer supported.

[1] http://thread.gmane.org/gmane.comp.version-control.git/210329
[2] http://article.gmane.org/gmane.comp.version-control.git/210429
[3] http://thread.gmane.org/gmane.comp.version-control.git/214579
[4] http://docs.python.org/3.3/howto/pyporting.html#try-to-support-python-2-6-and-newer-only
[5] http://www.python.org/dev/peps/pep-0404/

Signed-off-by: Junio C Hamano <gitster@pobox.com>
[SQUASH] mergetools: tweak show_tool_names and its users

Use show_tool_names as a function to produce output, not as a
function to compute a string.  Indicate if any output was given
with its return status, so that the caller can say "if it didn't
give any output, I'll say this instead" easily.

To be squashed into the previous; no need to keep this log message.
doc: generate a list of valid merge tools

Use the show_tool_names() function to build lists of all
the built-in tools supported by difftool and mergetool.
This frees us from needing to update the documentation
whenever a new tool is added.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'da/mergetool-docs' into jch

Build on top of the clean-up done by jk/mergetool and automatically
generate the list of mergetool and difftool backends the build
supports to be included in the documentation.

This is looking ready for 'next'.

* da/mergetool-docs:
  doc: generate a list of valid merge tools
  [SQUASH] mergetools: tweak show_tool_names and its users
  mergetool--lib: add functions for finding available tools
  mergetool--lib: improve the help text in guess_merge_tool()
  mergetool--lib: simplify command expressions

Conflicts:
	Documentation/Makefile
Merge branch 'jk/gc-auto-after-fetch' into jch

This is to resolve merge conflicts early for the same topic to
recent codebase.

Will merge to 'next'.

* jk/gc-auto-after-fetch:
  fetch-pack: avoid repeatedly re-scanning pack directory
  fetch: run gc --auto after fetching
Merge branch 'jk/read-commit-buffer-data-after-free' into jch

Clarify the ownership rule for commit->buffer field, which some
callers incorrectly accessed without making sure the data is
available there.

Will merge to 'next'.

* jk/read-commit-buffer-data-after-free:
  logmsg_reencode: lazily load missing commit buffers
  logmsg_reencode: never return NULL
  commit: drop useless xstrdup of commit message
Merge branch 'ss/mergetools-tortoise' into jch

Update mergetools to work better with newer merge helper tortoise ships.

Will merge to 'next'.

* ss/mergetools-tortoise:
  mergetools: allow passing pathnames with SP in them to TortoiseGitMerge
  mergetools: support TortoiseGitMerge
Merge branch 'bc/git-p4-for-python-2.4' into jch

With small updates to remove dependency on newer features of
Python, keep git-p4 usable with older Python.

Will merge to 'next'.

* bc/git-p4-for-python-2.4:
  git-p4.py: support Python 2.4
  git-p4.py: support Python 2.5
Merge branch 'nd/branch-error-cases' into jch

Fix various error messages and conditions in "git branch", e.g. we
advertised "branch -d/-D" to remove one or more branches but actually
implemented removal of zero or more branches---request to remove no
branches was not rejected.

Will merge to 'next', perhaps after rebasing on an older base
so that this can later be merged to the maintenance track.

* nd/branch-error-cases:
  branch: mark more strings for translation
  branch: give a more helpful message on redundant arguments
  branch: reject -D/-d without branch name
  branch: no detached HEAD check when editing another branch's description
Merge branch 'jc/hidden-refs' into jch

Allow the server side to unclutter the refs/ namespace it shows to
the client.  Optionally allow requests for histories leading to the
tips of hidden refs by updated clients (which are not written yet).

* jc/hidden-refs:
  fetch: fetch objects by their exact SHA-1 object names
  parse_fetch_refspec(): clarify the codeflow a bit
  upload-pack: optionally allow fetching from the tips of hidden refs
  receive-pack: reject an attempt to update/delete a hidden ref
  upload/receive-pack: allow hiding ref hiearchies
  upload-pack: simplify request validation
  upload-pack: share more code

Conflicts:
	builtin/receive-pack.c
	cache.h
Merge branch 'mp/complete-paths' into jch

The completion script used to let the default completer to suggest
pathnames, which gave too many irrelevant choices (e.g. "git add"
would not want to add an unmodified path).  Teach it to use a more
git-aware logic to enumerate only relevant ones.

This is logically the right thing to do, and we would really love
to see people who have been involved in completion code to review
and comment on the implementation.

Will merge to 'next' to see if anybody screams.

* mp/complete-paths:
  git-completion.bash: add support for path completion
Merge branch 'ab/gitweb-use-same-scheme' into jch

Avoid mixed contents on a page coming via http and https when
gitweb is hosted on a https server.

Will merge to 'next'.

* ab/gitweb-use-same-scheme:
  gitweb: refer to picon/gravatar images over the same scheme
Merge branch 'pw/git-p4-on-cygwin' into pu

Improve "git p4" on Cygwin.  The cover letter said it is not yet
ready for full Windows support so I won't move this to 'next' until
told by the author (the area maintainer) otherwise.

* pw/git-p4-on-cygwin: (21 commits)
  git p4: introduce gitConfigBool
  git p4: avoid shell when calling git config
  git p4: avoid shell when invoking git config --get-all
  git p4: avoid shell when invoking git rev-list
  git p4: avoid shell when mapping users
  git p4: disable read-only attribute before deleting
  git p4 test: use test_chmod for cygwin
  git p4: cygwin p4 client does not mark read-only
  git p4 test: avoid wildcard * in windows
  git p4 test: use LineEnd unix in windows tests too
  git p4 test: newline handling
  git p4: scrub crlf for utf16 files on windows
  git p4: remove unreachable windows \r\n conversion code
  git p4 test: translate windows paths for cygwin
  git p4 test: start p4d inside its db dir
  git p4 test: use client_view in t9806
  git p4 test: avoid loop in client_view
  git p4 test: use client_view to build the initial client
  git p4: generate better error message for bad depot path
  git p4: remove unused imports
  ...