fast-export: quote paths with spaces

A path containing a space must be quoted when used as an
argument to either the copy or rename commands (because
unlike other commands, the path is not the final thing on
the line for those commands).

Commit 6280dfdc3b (fast-export: quote paths in output,
2011-08-05) previously attempted to fix fast-export's
quoting by passing all paths through quote_c_style().
However, that function does not consider the space to be a
character which requires quoting, so let's special-case the
space inside print_path(). This will cause space-containing
paths to also be quoted in other commands where such quoting
is not strictly necessary, but it does not hurt to do so.

The test from 6280dfdc3b did not detect this because, while
it does introduce renames in the export stream, it does not
actually turn on rename detection, so they were presented as
pairs of deletions/adds. Using "-M" reveals the bug.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-index.c: "git diff" has no need to read blob from the standard input

Only "diff --no-index -" does.  Bolting the logic into the low-level
function diff_populate_filespec() was a layering violation from day
one.  Move populate_from_stdin() function out of the generic diff.c
to its only user, diff-index.c.

Also make sure "-" from the command line stays a special token "read
from the standard input", even if we later decide to sanitize the
result from prefix_filename() function in a few obvious ways,
e.g. removing unnecessary "./" prefix, duplicated slashes "//" in
the middle, etc.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'js/fast-export-paths-with-spaces' into jch

"git fast-export" produced an input stream for fast-import without
properly quoting pathnames when they contain SPs in them.

This may want some tests, but otherwise looked good.

Will merge to 'next'.

# By Jay Soffian
* js/fast-export-paths-with-spaces:
  fast-export: quote paths with spaces
Merge branch 'mm/config-xdg' into jch

Teach git to read various information from $XDG_CONFIG_HOME/git/ to allow
the user to avoid cluttering $HOME.

Will merge to 'next'.

# By Huynh Khoi Nguyen Nguyen
* mm/config-xdg:
  config: write to $XDG_CONFIG_HOME/git/config file when appropriate
  Let core.attributesfile default to $XDG_CONFIG_HOME/git/attributes
  Let core.excludesfile default to $XDG_CONFIG_HOME/git/ignore
  config: read (but not write) from $XDG_CONFIG_HOME/git/config file
Merge branch 'mm/credential-plumbing' into jch

Expose the credential API to scripted Porcelain writers.

Will merge to 'next'.

# By Matthieu Moy (2) and Javier Roucher Iglesias (1)
* mm/credential-plumbing:
  git-remote-mediawiki: add credential support
  git credential fill: output the whole 'struct credential'
  add 'git credential' plumbing command
Merge branch 'mm/mediawiki-file-attachments' into jch

"mediawiki" remote helper (in contrib/) learned to handle file
attachments.

Will merge to 'next'.

# By Matthieu Moy (3) and others
* mm/mediawiki-file-attachments:
  git-remote-mediawiki: import "File:" attachments
  git-remote-mediawiki: split get_mw_pages into smaller functions
  git-remote-mediawiki: send "File:" attachments to a remote wiki
  git-remote-mediawiki: don't "use encoding 'utf8';"
  git-remote-mediawiki: don't compute the diff when getting commit message
Merge branch 'rj/platform-pread-may-be-thread-unsafe' into jch

On Cygwin, the platform pread(3) is not thread safe, just like our
own compat/ emulation, and cannot be used in the index-pack program.

Will merge to 'next'.

* rj/platform-pread-may-be-thread-unsafe:
  index-pack: Disable threading on cygwin
Merge branch 'jc/apply-3way' into jch

"git apply" learns to wiggle the base version and perform three-way merge
when a patch does not exactly apply to the version you have.

Waiting for comments.

* jc/apply-3way:
  apply --3way: tests
  apply: document --3way option
  apply: allow rerere() upon --3way results
  apply: register conflicted stages to the index
  apply: --3way with add/add conflict
  apply: move verify_index_match() higher
  apply: plug the three-way merge logic in
  apply: fall back on three-way merge
  apply: accept -3/--3way command line option
  apply: move "already exists" logic to check_to_create()
  apply: move check_to_create_blob() closer to its sole caller
  apply: further split load_preimage()
  apply: refactor "previous patch" logic
  apply: split load_preimage() helper function out
  apply: factor out checkout_target() helper function
  apply: refactor read_file_or_gitlink()
  apply: clear_image() clears things a bit more
  apply: a bit more comments on PATH_TO_BE_DELETED
  apply: fix an incomplete comment in check_patch()

Conflicts:
	builtin/apply.c
Merge branch 'jn/perl-makemaker-leading-paths' into jch

Will merge to 'next' after waiting for a few more days.

# By Jonathan Nieder
* jn/perl-makemaker-leading-paths:
  perl/Makefile: move "mkdir -p" to module installation loop for maintainability
Merge branch 'tr/maint-show-walk' into jch

Fixes "git show"'s auto-walking behaviour, and make it behave just
like "git log" does when it walks.

Note that this is different from Thomas's patch.

Waiting for response from original author.

# By Junio C Hamano (1) and Thomas Rast (1)
* tr/maint-show-walk:
  show: fix "range implies walking"
  Demonstrate git-show is broken with ranges
Merge branch 'jk/version-string-dependency' into jch

Will keep in 'pu' to give Peff and Jonathan to work out improvements
for a week or so.

# By Jeff King
* jk/version-string-dependency:
  Makefile: move GIT-VERSION-FILE dependencies closer to use
  Makefile: build instaweb similar to other scripts
  Makefile: update scripts when build-time parameters change
  Makefile: do not replace @@GIT_VERSION@@ in shell scripts
  Makefile: split prefix flags from GIT-CFLAGS
  Makefile: split GIT_USER_AGENT from GIT-CFLAGS
  Makefile: do not replace @@GIT_USER_AGENT@@ in scripts
  Makefile: apply dependencies consistently to sparse/asm targets
  Makefile: do not have git.o depend on common-cmds.h
  Makefile: fold MISC_H into LIB_H
  Makefile: sort LIB_H list
Merge branch 'vr/use-our-perl-in-tests' into jch

The tip one is iffy and needs to be carefully proof-read by folks
who have worked on adding various features to the test suite, e.g.
valgrind, testing in an out of tree trash area, running under prove,
etc.

# By Junio C Hamano (4) and Vincent van Ravesteijn (1)
* vr/use-our-perl-in-tests:
  test-lib: reorder and include GIT-BUILD-OPTIONS a lot earlier
  t/README: add a bit more Don'ts
  tests: enclose $PERL_PATH in double quotes
  t/test-lib.sh: export PERL_PATH for use in scripts
  t: Replace 'perl' by $PERL_PATH
Merge branch 'jc/sha1-name-more' into jch

Teaches the object name parser that a "git describe" output is
always a commit object, to prolong the lifetime of abbreviated
object name in it.

It has a handful of tests that expect failure and show directions
for a couple of enhancement ideas.

Will merge to 'next'.

* jc/sha1-name-more:
  sha1_name.c: get_describe_name() by definition groks only commits
  sha1_name.c: teach get_short_sha1() a commit-only option
  sha1_name.c: allow get_short_sha1() to take other flags
  sha1_name.c: restructure disambiguation of short names
  sha1_name.c: correct misnamed "canonical" and "res"
  sha1_name.c: refactor find_short_packed_object()
  sha1_name.c: rename "now" to "current"
  sha1_name.c: clarify what "fake" is for in find_short_object_filename()
  sha1_name.c: indentation fix
Merge branch 'jk/no-more-pre-exec-callback' into pu

Will defer for 6 months until ancient "less" goes extinct.

# By Jeff King
* jk/no-more-pre-exec-callback:
  pager: drop "wait for output to run less" hack
Merge branch 'db/vcs-svn' into pu

Waiting for Jonathan's clean-up offered earlier.

# By David Barr
* db/vcs-svn:
  vcs-svn: drop no-op reset methods
  vcs-svn: fix signedness warnings
  vcs-svn: prefer strstr over memmem
  vcs-svn: prefer constcmp to prefixcmp
  vcs-svn: simplify cleanup in apply_one_window()
  vcs-svn: fix clang-analyzer error
Merge branch 'jc/split-blob' into pu

Not ready.

I finished the streaming checkout codepath, but as explained in
127b177 (bulk-checkin: support chunked-object encoding, 2011-11-30),
these are still early steps of a long and painful journey. At least
pack-objects and fsck need to learn the new encoding for the series
to be usable locally, and then index-pack/unpack-objects needs to
learn it to be used remotely.

Given that I heard a lot of noise that people want large files, and
that I was asked by somebody at GitTogether'11 privately for an
advice on how to pay developers (not me) to help adding necessary
support, I am somewhat dissapointed that the original patch series
that was sent almost two months ago still remains here without much
comments and updates from the developer community. I even made the
interface to the logic that decides where to split chunks easily
replaceable, and I deliberately made the logic in the original patch
extremely stupid to entice others, especially the "bup" fanboys, to
come up with a better logic, thinking that giving people an easy
target to shoot for, they may be encouraged to help out. The plan is
not working :-(.

* jc/split-blob:
  chunked-object: streaming checkout
  chunked-object: fallback checkout codepaths
  bulk-checkin: support chunked-object encoding
  bulk-checkin: allow the same data to be multiply hashed
  new representation types in the packstream
  packfile: use varint functions

Conflicts:
	builtin/pack-objects.c
	streaming.c
	t/t1050-large.sh
Merge branch 'jc/maint-push-refs-all' into pu

Allows pushing and fetching refs/stash.
There still seem to be other bugs hiding (e.g. try pushing twice).

Not ready.

* jc/maint-push-refs-all:
  get_fetch_map(): tighten checks on dest refs
  fetch/push: allow refs/*:refs/*
Merge branch 'jk/no-op-push-message' into pu

Rewords the status message of "git push" that pushed only one ref
differently from "Everything up-to-date", to give a bit more help to
people who get the message when their current branch is not pushed.

I had an impression after the discussion thread that a redesign is
coming, but it hasn't happened yet.

Will discard without prejudice, unless rerolled.

# By Jeff King
* jk/no-op-push-message:
  improve no-op push output
Merge branch 'nl/http-proxy-more' into pu

I queued only the later two patches from this series, even though they do
not make much sense without the first one that seems to need a bit more
work, so that we won't forget.

Will discard without prejudice, unless rerolled.

# By Jeff King (1) and Nelson Benitez Leon (1)
* nl/http-proxy-more:
  http: rename HTTP_REAUTH to HTTP_AUTH_RETRY
  http: Avoid limit of retrying request only twice
Merge branch 'tb/sanitize-decomposed-utf-8-pathname' into pu

Teaches git to normalize pathnames read from readdir(3) and all
arguments from the command line into precomposed UTF-8 (assuming
that they come as decomposed UTF-8) to work around issues on Mac OS.

I think there still are other places that need conversion
(e.g. paths that are read from stdin for some commands), but this
should be a step in the right direction.

Will merge to 'next'.

# By Torsten Bögershausen
* tb/sanitize-decomposed-utf-8-pathname:
  git on Mac OS and precomposed unicode