Permalink
Browse files

build-git: a script to build a backdated git repo

  • Loading branch information...
diotteo committed Aug 11, 2017
1 parent 6379901 commit 3b7f1b332454a545dd0411c22e5e5b1ef659b5a3
Showing with 33 additions and 0 deletions.
  1. +33 −0 git-backdating/build-git
@@ -0,0 +1,33 @@
#! /bin/bash
GIT_BASE_DIR='/home/dioo/Prog/old-projects/libsdlinput_test'
pushd "${GIT_BASE_DIR}"
rm -rf * .git || true
git init .
popd
#sed -n '2,$ { p }' < listing.txt | while read line; do
while read line; do
datestr="$(cut -c-19 <<<"$line") UTC"
file=$(cut -c29- <<<"$line")
afile='/home/dioo/Prog/old-projects/rsync-copy/libsdlinput/'"$file"
echo "afile = $afile"
pushd ${GIT_BASE_DIR}
if [[ "$afile" =~ .tar.gz$ ]]; then
tar -xf "$afile"
elif [[ "$afile" =~ .zip$ ]]; then
unzip -o "$afile"
else
d=$(dirname "$file")
mkdir -p "${d}"
cp -v "$afile" "$file"
fi
if git status --porcelain >/dev/null; then
git add .
git commit --date "${datestr}" -m "Commit archive ${file}" -m "Timestamp: ${datestr}"
fi
popd
done < <(sed -n '1,$ { p }' < listing.txt)

0 comments on commit 3b7f1b3

Please sign in to comment.