Browse files

publish: back up and restore old index; use add -f

Instead of deleting the index at the start and forgetting to restore it
at the end, we now rename the index file and restore this backup upon

The git-add command fails if a named file is in .gitignore.  In our
case, most of the files are, so we need the -f flag to skip the ignore
  • Loading branch information...
1 parent 062e3cc commit 498df3bdf96424a77a99dc93f98d42fd1a0c4a13 @MarkLodato committed Feb 8, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 publish
@@ -18,11 +18,12 @@ fi
HEAD=`git symbolic-ref HEAD`
SHA=`git rev-parse HEAD`
git symbolic-ref HEAD refs/heads/gh-pages || exit $?
-rm -f .git/index || exit $?
-git add "$@" || exit $?
+mv .git/index .git/index.old || exit $?
+git add -f "$@" || exit $?
if git diff --quiet --cached; then
echo "nothing to commit..."
git commit -m "build from $SHA" || exit $?
git symbolic-ref HEAD "$HEAD" || exit $?
+mv .git/index.old .git/index || exit $?

0 comments on commit 498df3b

Please sign in to comment.