-if (-d "$destdir/.git") {
- chdir $destdir or die "chdir $destdir: $!";
- if (0 != system (qw(git remote set-url origin), $repo)) {
- # awful... for old versions of git that don't know "remote set-url"
- shell_or_die (q(perl -pi~ -e '$_="\turl = ).$repo.q(\n" if /url = /' .git/config));
- }
-}
-elsif ($repo && $commit)
-{
- shell_or_die('git', 'clone', $repo, $destdir);
- chdir $destdir or die "chdir $destdir: $!";
- shell_or_die(qw(git config clean.requireForce false));
-}
-else {
- die "$destdir does not exist, and no repo/commit specified -- giving up";
-}
-
-if ($commit) {
- unlink "$destdir.commit";
- shell_or_die (qw(git stash));
- shell_or_die (qw(git clean -d -x));
- shell_or_die (qw(git fetch origin));
- shell_or_die (qw(git checkout), $commit);
+mkdir $destdir;
+open TARX, "|-", "tar", "-C", $destdir, "-xf", "-";
+print TARX <DATA>;
+if(!close(TARX)) {
+ die "'tar -C $destdir -xf -' exited $?: $!";