Skip to content

Commit

Permalink
Scripts to fix the broken commits in this repo
Browse files Browse the repository at this point in the history
The result of this can be pushed to github and passes a "git fsck"
  • Loading branch information
David Scott committed Jan 8, 2013
1 parent 3921792 commit 04849db
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions fix-broken-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

export FIX_DATE=`pwd`/../fix-date.sh
[ -x $FIX_DATE ] || exit 1
# xen-api fails a "git fsck" because it has bad timezone data in commit timestamps::
# '@ <Jonathan Ludlam <Jonathan.Ludlam@eu.citrix.com> > 1255377615 +0100'
git filter-branch -f --commit-filter '
echo "id = $GIT_COMMIT committer date = $GIT_COMMITTER_DATE" >> /tmp/foo
echo "id = $GIT_COMMIT author date = $GIT_AUTHOR_DATE" >> /tmp/foo
GIT_COMMITTER_DATE2=$(${FIX_DATE} "${GIT_COMMITTER_DATE}")
GIT_AUTHOR_DATE2=$(${FIX_DATE} "${GIT_AUTHOR_DATE}")
if [ "${GIT_COMMITTER_DATE}" != "${GIT_COMMITTER_DATE2}" ];
then
echo "Rewriting ${GIT_COMMITTER_DATE} > ${GIT_COMMITTER_DATE2}" >> /tmp/foo
export GIT_COMMITTER_DATE="${GIT_COMMITTER_DATE2}"
fi
if [ "${GIT_AUTHOR_DATE}" != "${GIT_AUTHOR_DATE2}" ];
then
echo "Rewriting ${GIT_AUTHOR_DATE} > ${GIT_AUTHOR_DATE2}" >> /tmp/foo
export GIT_AUTHOR_DATE="${GIT_AUTHOR_DATE2}"
fi
git commit-tree "$@";
' --tag-name-filter cat -- --all
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune
4 changes: 4 additions & 0 deletions fix-date.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

echo "$1" | sed -r 's/.*@[^0-9]*([0-9]+ [+-][0-9]+)/@\1/g'

0 comments on commit 04849db

Please sign in to comment.