#!/usr/bin/env bash

# A test for issue662, which triggered: 
#  darcs failed:  Error applying hunk to file ./t.t
#  Error applying patch to the working directory.

IFS='';
export IFS;
EMAIL=tester;
export EMAIL;

set -ev;

rm -rf tmp;
darcs init --hashed --repodir=tmp
touch tmp/t.t
cd tmp
darcs add t.t
echo 'content'>t.t
darcs record -am 'initial add' --ignore
echo 'content: remote change'>t.t
darcs record -am 'remote change' --ignore
darcs put tmp2
cd tmp2
darcs obliterate --last 1 --all;
echo 'content: local change'> t.t
darcs pull -a ../
darcs w -s
darcs revert -a
