attr: more matching optimizations from .gitignore

.gitattributes and .gitignore share the same pattern syntax but has
separate matching implementation. Over the years, ignore's
implementation accumulates more optimizations while attr's stays the
same.

This patch adds those optimizations to attr. Basically it tries to
avoid fnmatch as much as possible in favor of strncmp.

A few notes from this work is put in the documentation:

* "!pattern" syntax is forbidden in .gitattributes.  As an attribute
  can be unset (i.e. set to a special value "false") or made back to
  unspecified (i.e. not even set to "false"), "!pattern attr" is unclear
  which one it means.

* we support attaching attributes to directories, but git-core
  internally does not currently make use of attributes on
  directories.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Support "**" wildcard in .gitignore and .gitattributes

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t3070: disable two fnmatch tests that have different results on different libc

fnmatch on glibc-2.12.1 returns no match. glibc-2.15 returns ok.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'fa/vcs-svn' into pu

A follow-up to a GSoC project, but seems not quite ready.
Will discard.

* fa/vcs-svn:
  vcs-svn: remove repo_tree
  vcs-svn/svndump: rewrite handle_node(), begin|end_revision()
  vcs-svn/svndump: restructure node_ctx, rev_ctx handling
  svndump: move struct definitions to .h
Merge branch 'tx/relative-in-the-future' into pu

Not my itch; rewritten an earlier submission by Tom Xue into
somewhat more maintainable form, though it breaks existing i18n.

Waiting for a voluteer to fix it up.
Otherwise may discard.

* tx/relative-in-the-future:
  date: show relative dates in the future
  date: refactor the relative date logic from presentation
Merge branch 'jc/maint-push-refs-all' into pu

Allows pushing and fetching everything including refs/stash.
This is broken (see the log message there).

Not ready.

* jc/maint-push-refs-all:
  get_fetch_map(): tighten checks on dest refs
  [BROKEN] fetch/push: allow refs/*:refs/*
Merge branch 'jx/test-real-path' into pu

Running tests with the "trash" directory elsewhere with the "--root"
option did not work well if the directory was specified by a symbolic
link pointing at it.

Seems broken as it makes $(pwd) and TRASH_DIRECTORY inconsistent.
Will discard.

* jx/test-real-path:
  test: set the realpath of CWD as TRASH_DIRECTORY
Merge branch 'as/test-tweaks' into pu

Various minor tweaks to the test framework to paint its output
lines in colors that match what they mean better.

Has the "is this really blue?" issue Peff raised resolved???

* as/test-tweaks:
  tests: paint unexpectedly fixed known breakages in bold red
  tests: test the test framework more thoroughly
  [SQUASH] t/t0000-basic.sh: quoting of TEST_DIRECTORY is screwed up
  tests: refactor mechanics of testing in a sub test-lib
  tests: paint skipped tests in bold blue
  tests: test number comes first in 'not ok $count - $message'
  tests: paint known breakages in bold yellow
Merge branch 'ms/contrib-thunderbird-updates' into pu

Update helper to send out format-patch output using Thunderbird.
Seems to have design regression for silent users.

* ms/contrib-thunderbird-updates:
  [SQUASH] minimum fixup
  Thunderbird: fix appp.sh format problems
Merge branch 'mb/remote-default-nn-origin' into pu

When the user does not specify what remote to interact with, we
often attempt to use 'origin'.  This can now be customized via a
configuration variable.

Expecting a reroll.

"The first remote becomes the default" bit is better done as a
separate step.

* mb/remote-default-nn-origin:
  Teach get_default_remote to respect remote.default.
  Test that plain "git fetch" uses remote.default when on a detached HEAD.
  Teach clone to set remote.default.
  Teach "git remote" about remote.default.
  Teach remote.c about the remote.default configuration setting.
  Rename remote.c's default_remote_name static variables.

Conflicts:
	builtin/remote.c
	t/t5505-remote.sh
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 long time 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" fanbois, 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 'ph/credential-refactor' into pu

Attempts to refactor to share code among OSX keychain, Gnome keyring
and Win32 credential helpers.

* ph/credential-refactor:
  wincred: port to generic credential helper
  osxkeychain: port to generic credential helper implementation
  gnome-keyring: port to generic helper implementation
  contrib: add generic credential helper
Merge branch 'jc/xprm-generation' into pu

A toy to analyze how bad the clock skews are in histories of real
world projects.

Stalled mostly due to lack of responses.

* jc/xprm-generation:
  test-generation: compute generation numbers and clock skews
Merge branch 'nd/pretty-placeholder-with-color-option' into pu

* nd/pretty-placeholder-with-color-option:
  pretty: support %>> that steal trailing spaces
  pretty: support truncating in %>, %< and %><
  pretty: support padding placeholders, %< %> and %><
  pretty: two phase conversion for non utf-8 commits
  utf8.c: add utf8_strnwidth() with the ability to skip ansi sequences
  utf8.c: move display_mode_esc_sequence_len() for use by other functions
  pretty: support %C(auto[,N]) to turn on coloring on next placeholder(s)
  pretty: split parsing %C into a separate function
  pretty: share code between format_decoration and show_decorations
Merge branch 'as/check-ignore' into pu

Waiting for a reroll.

* as/check-ignore:
  [SQUASH-FIX] 283d072 (Add git-check-ignore sub-command, 2012-09-20)
  [SQUASH-FIX] 283d072 (Add git-check-ignore sub-command, 2012-09-20)
  [REROLL NEEDED] minimum compilation fix
  Add git-check-ignore sub-command
  dir.c: provide free_directory() for reclaiming dir_struct memory
  pathspec.c: move reusable code from builtin/add.c
  dir.c: refactor treat_gitlinks()
  dir.c: keep track of where patterns came from
  dir.c: refactor is_path_excluded()
  dir.c: refactor is_excluded()
  dir.c: refactor is_excluded_from_list()
  dir.c: rename excluded() to is_excluded()
  dir.c: rename excluded_from_list() to is_excluded_from_list()
  dir.c: rename path_excluded() to is_path_excluded()
  dir.c: rename cryptic 'which' variable to more consistent name
  Improve documentation and comments regarding directory traversal API
  Update directory listing API doc to match code
Merge branch 'jk/lua-hackery' into pu

Interesting exercise. When we do this for real, we probably would want
to wrap a commit to make it more like an "object" with methods like
"parents", etc.

* jk/lua-hackery:
  pretty: fix up one-off format_commit_message calls
  Minimum compilation fixup
  Makefile: make "lua" a bit more configurable
  add a "lua" pretty format
  add basic lua infrastructure
  pretty: make some commit-parsing helpers more public

Conflicts:
	pretty.c
Merge branch 'nd/attr-match-optim-more' into pu

Start laying the foundation to build the "wildmatch" after we can
agree on its desired semantics.

* nd/attr-match-optim-more:
  attr: more matching optimizations from .gitignore
  gitignore: make pattern parsing code a separate function

Conflicts:
	dir.c
Merge branch 'jc/doc-default-format' into pu

Need to address the installation half if this is to be any useful.

* jc/doc-default-format:
  [SQAUSH] allow "cd Doc* && make DEFAULT_DOC_TARGET=..."
  Allow generating a non-default set of documentation
Merge branch 'js/format-2047' into pu

Fixes many rfc2047 quoting issues in the output from format-patch.

* js/format-2047:
  format-patch: tests: check rfc822+rfc2047 in to+cc headers
  format-patch: fix rfc2047 address encoding with respect to rfc822 specials
  format-patch: introduce helper function last_line_length()
  format-patch: do not wrap rfc2047 encoded headers too late
  format-patch: do not wrap non-rfc2047 headers too early
Merge branch 'nd/wildmatch' into pu

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

This might be missing some off-by-one fix posted on the list, and
needs to be checked.

* nd/wildmatch:
  t3070: disable two fnmatch tests that have different results on different libc
  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
  Integrate wildmatch to git
  wildmatch: remove unnecessary functions
  Import wildmatch from rsync
  ctype: support iscntrl, ispunct, isxdigit and isprint
  ctype: make sane_ctype[] const array

Conflicts:
	attr.c
	dir.c
	t/t0003-attributes.sh