contrib: add credential helper for GnomeKeyring

With this installed in your $PATH, you can store
git-over-http passwords in your keyring by doing:

git config credential.helper gnome-keyring

The code is based in large part on the work of John Szakmeister
who wrote the helper originally for the initial, unpublished
version of the credential helper protocol.

This version will pass t0303 if you do:

  GIT_TEST_CREDENTIAL_HELPER=gnome-keyring \
  ./t0303-credential-external.sh

Signed-off-by: Philipp A. Hartmann <pah@qo.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib: add generic credential helper

This adds a generic implementation for credential helpers.

It provides a header file credential_helper.h containing
a simplified credential API and common helper functions.
The implementation in credential_helper.c already provides
a main() function and chooses the credential operation
from a function table:

  struct credential_operation const credential_helper_ops[] =
  {
      { "get",   my_backend_get   },
      { "store", my_backend_store },
      { "erase", my_backend_erase },
      CREDENTIAL_OP_END
  };

With this, a specific credential helper backend usually only
needs to implement these operation callbacks.

Signed-off-by: Philipp A. Hartmann <pah@qo.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gnome-keyring: port to generic helper implementation

Use generic credential helper implementation in the
GnomeKeyring credential helper.

The GnomeKeyring helper has been using the generic implementation
internally already and therefore only drops the duplicate code.

Signed-off-by: Philipp A. Hartmann <pah@qo.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
osxkeychain: port to generic credential helper implementation

This reduces code duplication in the osxkeychain helper by
basing the implementation on the generic helper implementation.

Alongside, the return codes of the helper are tightened to be
more consistent in corner cases and the memory containing
cleartext passwords is explicitly cleared when possible.

Signed-off-by: Philipp A. Hartmann <pah@qo.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
vcs-svn: Fix 'fa/remote-svn' and 'fa/vcs-svn' in pu

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'mm/push-default-switch-warning' into jch

(Originally merged to 'next' on 2012-06-26)

In the next major release, we will switch "git push [$there]" that
does not say what to push from the traditional "matching" to the
updated "simple" semantics, that pushes the current branch to the
branch with the same name only when the current branch is set to
integrate with that remote branch (all other cases will error out).

Will merge to 'master' as part of the second batch.

* mm/push-default-switch-warning:
  push: start warning upcoming default change for push.default
Merge branch 'jk/maint-null-in-trees' into jch

(Originally merged to 'next' on 2012-07-30)

We do not want a link to 0{40} object stored anywhere in our objects.

Will merge to 'master' as part of the second batch.

* jk/maint-null-in-trees:
  fsck: detect null sha1 in tree entries
  do not write null sha1s to on-disk index
  diff: do not use null sha1 as a sentinel value

Conflicts:
	diff-no-index.c
	read-cache.c
Merge branch 'jc/maint-t7406-rev-parse-max-count-huh' into jch

(Originally merged to 'next' on 2012-07-30)

Test clean-up, with no behaviour change.
Will merge to 'master' as part of the second batch.

* jc/maint-t7406-rev-parse-max-count-huh:
  t7406: fix misleading "rev-parse --max-count=1 HEAD"
Merge branch 'ab/diff-write-incomplete-line' into jch

(Originally merged to 'next' on 2012-08-07)

The output from "git diff -B" for a file that ends with an
incomplete line did not put "\ No newline..." on a line of its own.

Will merge to 'master' as part of the second batch.

* ab/diff-write-incomplete-line:
  Fix '\ No newline...' annotation in rewrite diffs
Merge branch 'bc/receive-pack-stdout-protection' into jch

(Originally merged to 'next' on 2012-08-07)

When "git push" triggered the automatic gc on the receiving end, a
message from "git prune" that said it was removing cruft leaked to
the standard output, breaking the communication protocol.

Will merge to 'master' as part of the second batch.

* bc/receive-pack-stdout-protection:
  receive-pack: do not leak output from auto-gc to standard output
  t/t5400: demonstrate breakage caused by informational message from prune
Merge branch 'js/grep-patterntype-config' into jch

(Originally merged to 'next' on 2012-08-09)

"grep" learned to use a non-standard pattern type by default if a
configuration variable tells it to.

Will merge to 'master' as part of the second batch.

* js/grep-patterntype-config:
  grep: add a grep.patternType configuration setting
Merge branch 'da/difftool-updates' into jch

(Originally merged to 'next' on 2012-08-10)

"git difftool --dir-diff" learned to use symbolic links to prepare
temporary copy of the working tree when available.

Will merge to 'master' as part of the second batch.

* da/difftool-updates:
  difftool: silence warning
  Add Code Compare v2.80.4 as a merge / diff tool for Windows
  mergetool,difftool: Document --tool-help consistently
  difftool: Disable --symlinks on cygwin
  difftool: Handle compare() returning -1
  difftool: Wrap long lines for readability
  difftool: Check all return codes from compare()
  difftool: Handle finding mergetools/ in a path with spaces
  difftool: Use symlinks when diffing against the worktree
  difftool: Call the temp directory "git-difftool"
  difftool: Move option values into a hash
  difftool: Eliminate global variables
  difftool: Simplify print_tool_help()
Merge branch 'jk/docs-docbook-monospace-display' into jch

(Originally merged to 'next' on 2012-08-18)

The documentation in the TeXinfo format was using indented output
for materials meant to be examples that are better typeset in
monospace.

Will merge to 'master' as part of the second batch.

* jk/docs-docbook-monospace-display:
  docs: monospace listings in docbook output
Merge branch 'jc/maint-config-exit-status' into jch

(Originally merged to 'next' on 2012-07-30)

The exit status code from "git config" was way overspecified while
being incorrect.  Update the implementation to give the documented
status for a case that was documented, and introduce a new code for
"all other errors".

Will merge to 'master' as part of the third batch.

* jc/maint-config-exit-status:
  config: "git config baa" should exit with status 1

Conflicts:
	builtin/config.c
Merge branch 'jc/maint-sane-execvp-notdir' into jch

(Originally merged to 'next' on 2012-08-09)

"git foo" errored out with "Not a directory" when the user had a non
directory on $PATH, and worse yet it masked an alias "foo" to run.

Will merge to 'master' as part of the third batch.

* jc/maint-sane-execvp-notdir:
  sane_execvp(): ignore non-directory on $PATH
Merge branch 'cw/cherry-pick-allow-empty-message' into jch

(Originally merged to 'next' on 2012-08-09)

"git cherry-pick" by default stops when it sees a commit without any
log message.  The "--allow-empty-message" option can be used to
silently proceed.

Will merge to 'master' as part of the third batch.

* cw/cherry-pick-allow-empty-message:
  cherry-pick: add --allow-empty-message option
Merge branch 'jk/version-string' into jch

(Originally merged to 'next' on 2012-08-10)

Leftover bits from the "git version" code restructuring, that give
us an ability to expose the Git version over the wire in the
protocol exchange. But we do so carefully only to the other end that
understands it.

Will merge to 'master' as part of the third batch.

* jk/version-string:
  do not send client agent unless server does first
  send-pack: fix capability-sending logic
  include agent identifier in capability string
Merge branch 'mz/cherry-code-cleanup' into jch

Minor code clean-up on the cherry-pick codepath.

Will merge to 'master' as part of the second batch.

* mz/cherry-code-cleanup:
  cherry: remove redundant check for merge commit
  cherry: don't set ignored rev_info options
  remove unnecessary parameter from get_patch_ids()
Merge branch 'bc/prune-info' into jch

Teach "git prune" without "-v" to be silent about leftover temporary files.

Will merge to 'master' as part of the second batch.

* bc/prune-info:
  prune.c: only print informational message in show_only or verbose mode
Merge branch 'jc/maint-protect-sh-from-ifs' into jch

When the user exports a non-default IFS without HT, scripts that
rely on being able to parse "ls-files -s | while read a b c..."
start to fail.  Protect them from such a misconfiguration.

Will merge to 'master' as part of the second batch.

* jc/maint-protect-sh-from-ifs:
  sh-setup: protect from exported IFS