Make backup copies of state files

If a conversion fails we want the previous state files preserved, both
for debugging but also to allow us to recover.
This commit is contained in:
Frej Drejhammar
2016-12-28 12:14:04 +01:00
parent 1d0f6cb7ca
commit 01d71a2d3f

View File

@@ -85,6 +85,13 @@ do
shift
done
# Make a backup copy of each state file
for i in $SFX_STATE $SFX_MARKS $SFX_MAPPING $SFX_HEADS ; do
if [ -f "$GIT_DIR/$PFX-$i" ] ; then
cp "$GIT_DIR/$PFX-$i" "$GIT_DIR/$PFX-$i~"
fi
done
# for convenience: get default repo from state file
if [ x"$REPO" = x -a -f "$GIT_DIR/$PFX-$SFX_STATE" ] ; then
REPO="`grep '^:repo ' "$GIT_DIR/$PFX-$SFX_STATE" | cut -d ' ' -f 2`"