#!/bin/sh
set -ev

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

T=temp
rm -rf $T
mkdir $T
echo $T
cd $T
set -e
$DARCS initialize
echo text > afile.txt
$DARCS add afile.txt
$DARCS record --author me --all --no-test --patch-name init
mkdir d
$DARCS add d
mkdir d/e
$DARCS add d/e
$DARCS mv afile.txt d/e/afile.txt
echo altered_text > d/e/afile.txt
$DARCS record --author me --all --no-test --patch-name confusion
test ! -f _darcs/pristine/afile.txt
echo y/d/y | tr / \\012 | $DARCS unrecord
rm -rf $T
