Merge pull request #9 from rock-core/fix_importdir_and_git_caching

do not call update_alternates if package.importdir != package.srcdir
git: fix interaction between detached HEADs and only_local

When using local-only access and detached HEADs, the remote commit
was not properly resolved in #update, which would lead to an invalid
call to merge-base.
importers: streamline subprocess calling

This commit modifies all calls to Subprocess.run to get rid of Dir.chdir
as much as possible (with the longer term target to parallelize import),
as well as using Package#run instead of Subprocess.run directly. It finally
removes most calls to the backtick operator to call the autobuild run facilities
instead, ensuring proper quoting and error reporting
importers: make the retry behaviour a per-exception attribute

We basically only want to retry if the importer has hit the network.
In all other cases, the error is really final.
rework the windows handling code in Subprocess.run

The new code is a lot simpler, and also fixes a missing cleanup on
exception bug: if an exception was raised between the two chdirs, the
process would stay in the package's directory
svn: fix checkout
document Subcommand.run
git: reset --hard must be run with a working copy
display error messages on STDERR
allow passing IO objects directly as input to Subprocess.run
remove 1.8-compatibility code
chomp the lines output by subprocesses in Subprocess.run
git: simplify the update logic tremendously, and fix unncessary detached HEAD situations
git: be more specific in the rescue clause of #rev_parse
git: define #show
git: rename on_target_branch? to on_local_branch?
git: never create a detached HEAD

The current behaviour when commit: or tag: was given was to create
a detached HEAD, which is really really less than ideal.

Since we are going to use those a lot more, this commit tries to find
a better way. Namely, autobuild now resets the local branch to the
commit while trying to preserve uncommitted changes. It will do so
only if the branch contains only commits that are already on the remote
origin.
git: add support to test the git version

While most of the git CLI is fairly stable and backward compatible,
it happens that it breaks. For instance git update-index --cacheinfo
was given arguments delimited by spaces but is now (2.1.0) expecting
them with commas.
git: do not show the 'resetting ...' message if HEAD and target are the same
git: fix #commit_pinning with tags

This fixes a failure in #commit_pinning, where update-ref gets called
with a tag instead of a commit by resolving the commit explicitely.
Moreover, it fixes the rescue clause to ensure that it does not
create a detached HEAD