#!/usr/bin/env bash

cd "$(dirname $0)/..";

rm -rf sandbox;
mkdir  sandbox;

cd ./sandbox;

git init .;

echo '.git' > .gitignore;
git add .;
git commit -m'.gitignore';

for i in ../version/*; 
do
    (
        cd $i;
        find . | cpio -pdv ~-;
    );

    echo -e "$i\n$(ls -al)";
   
    git add *;
    git commit -m"$i";
    git tag -a "perl/$(basename $i)" -m"$i";
    git commit -m"tag $i";

    rm -rf *;
done

tar cf .git.tar .git;

# push fake sandbox into module's git.
# .gitignore avoids issues with
# submodule.

cd ..;
git add sandbox;
git commit -m'minimal sandbox for t/2*';

exit 0;

