Revert "Merge branch 'jc/test-prereq' into next"

This reverts commit 0e21c36f8a8021296e10cc411e42f53e8b6900b2,
reversing changes made to bd57cb8e61b16adc3b4ab8c84074ff452c0e56c5,
to rebuild the lazy test prerequiste topic.  As it won't be too late
in the upcoming release, we can keep the script more readable from
the beginning this way.
test: rename $satisfied to $satisfied_prereq

All other shell variables that are used to globally keep track of
states related to prerequisite have "prereq" somewhere in their
names.  Be consistent and avoid potential name crashes with other
kinds of satisfaction in the future.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
test: allow prerequisite to be evaluated lazily

The test prerequisite mechanism is a useful way to allow some tests
in a test script to be skipped in environments that do not support
certain features (e.g. it is pointless to attempt checking how well
symbolic links are handled by Git on filesystems that do not support
them).  It is OK for commonly used prerequisites to be always tested
during start-up of a test script by having a codeblock that tests a
feature and calls test_set_prereq, but for an uncommon feature,
forcing 90% of scripts to pay the same probing overhead for
prerequisite they do not care about is wasteful.

Introduce a mechanism to probe the prerequiste lazily.  Changes are:

 - test_lazy_prereq () function, which takes the name of the
   prerequisite it probes and the script to probe for it, is
   added.  This only registers the name of the prerequiste that can
   be lazily probed and the script to eval (without running).

 - test_have_prereq() function (which is used by test_expect_success
   and also can be called directly by test scripts) learns to look
   at the list of prerequisites that can be lazily probed, and the
   prerequisites that have already been probed that way.  When asked
   for a prerequiste that can be but haven't been probed, the script
   registered with an earlier call to test_lazy_prereq is evaluated
   and the prerequisite is set.

 - test_run_lazy_prereq_() function is a helper to run the probe
   script with the same kind of sandbox as regular tests, helped by
   Jeff King.

Update the codeblock to probe and set SYMLINKS prerequisite using
the new mechanism as an example.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
test-lib: provide case insensitivity as a prerequisite

Case insensitivity plays a role in several tests and is tested in several
tests. Therefore, move the test from t003 into the test lib and use the
prerequisite in t0003.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t0050: use the CASE_INSENSITIVE_FS test prereq

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t0050: use the SYMLINKS test prereq

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
test-lib: provide UTF8 behaviour as a prerequisite

UTF8 behaviour of the filesystem (conversion from nfd to nfc)  plays a
role in several tests and is tested in several tests. Therefore, move
the test from t0050 into the test lib and use the prerequisite in t0050.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Merge branch 'jc/test-prereq' into next

* jc/test-prereq:
  test-lib: provide UTF8 behaviour as a prerequisite
  t0050: use the SYMLINKS test prereq
  t0050: use the CASE_INSENSITIVE_FS test prereq
  test-lib: provide case insensitivity as a prerequisite
  test: allow prerequisite to be evaluated lazily
  test: rename $satisfied to $satisfied_prereq
Quiet warning if Makefile.PL is run with -w and no --localedir

Usually it isn't, but its nice if it can be run with warnings on.

Signed-off-by: Michael G Schwern <schwern@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Don't lose Error.pm if $@ gets clobbered.

In older Perls, sometimes $@ can become unset between the eval and
checking $@.  Its safer to check the eval directly.

Signed-off-by: Michael G Schwern <schwern@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
The Makefile.PL will now find .pm files itself.

It is no longer necessary to manually add new .pm files to the
Makefile.PL.  This makes it easier to add modules.

It is still necessary to add them to the Makefile, but that extra work
should be removed at a future date.

Signed-off-by: Michael G Schwern <schwern@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
perl: detect new files in MakeMaker builds

While Makefile.PL now finds .pm files on its own, it does not
detect new files after it generates perl/perl.mak.

[ew: commit message, minor tweaks]

ref: http://mid.gmane.org/7vlii51xz4.fsf@alter.siamese.dyndns.org

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Extract some utilities from git-svn to allow extracting Git::SVN.

Put them in a new module called Git::SVN::Utils.  Yeah, not terribly
original and it will be a dumping ground.  But its better than having
them in the main git-svn program.  At least they can be documented
and tested.

* fatal() is used by many classes.
* Change the $can_compress lexical into a function.

This should be enough to extract Git::SVN.

Signed-off-by: Michael G. Schwern <schwern@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Prepare Git::SVN for extraction into its own file.

This means it should be able to load without git-svn being loaded.

* Load Git.pm on its own and all the needed command functions.

* It needs to grab at a git-svn lexical $_prefix representing the --prefix
  option.  Provide opt_prefix() for that.  This is a refactoring artifact.
  The prefix should really be passed into Git::SVN->new.

* Unqualify unnecessarily fully qualified globals like
  $Git::SVN::default_repo_id.

* Lexically isolate the class just to make sure nothing is leaking out.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Extract Git::SVN from git-svn into its own .pm file.

Except for adding the 1; at the end, this is a straight copy & paste.

Tests still pass, but its doubtful Git::SVN will compile on its own
without git-svn being loaded.  Next commit will fix that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Move initialization of Git::SVN variables into Git::SVN.

Also it can compile on its own now, yay!

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Prepare Git::SVN::Log for extraction from git-svn.

* Load Git command functions itself.

* Can't access the git-svn switch lexical any more, but its only used by
  Git::SVN::Log so turn it into a Git::SVN::Log global.

* Load Git::SVN as needed.  No need to load it always, its only used twice.

* Moved a state variable to the routine it's used for. (Drive by refactoring)

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Extract Git::SVN::Log from git-svn.

Straight cut & paste.

Also noticed Git::SVN::Ra wasn't in the compile test.  It is now.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Prepare Git::SVN::Migration for extraction from git-svn.

* Load Git command functions on its own.
* Load Git::SVN modules on its own.

Drive by refactorings...
* Use our() instead of use vars.
* Eliminate the auto loading of Git functions.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Extract Git::SVN::Migration from git-svn.

Straight cut & paste.

Signed-off-by: Eric Wong <normalperson@yhbt.net>