#!/usr/bin/env bash
set -ev

test $DARCS || DARCS=$PWD/../darcs

rm -rf temp1
mkdir temp1
cd temp1
$DARCS initialize
echo ALL ignore-times >> _darcs/prefs/defaults
echo A1 > foo
mkdir d
echo A2 > d/bar
$DARCS add foo
$DARCS add d
$DARCS add d/bar
$DARCS record -a -m AA -A x
echo B > foo
$DARCS record -a -m BB -A x
echo C > foo
$DARCS record -a -m CC -A x

for i in _darcs/pristine*; do
  echo Empty the pristine directory: $i
  rm -rf $i
  mkdir $i
done

$DARCS repair

cd ..
rm -rf temp1
