#!/usr/bin/env bash

# issue279: a conflict case resulting in "bug in get_extra" with old
# format repos and "Malformed patch bundle" with darcs-2 repos.

. lib

# this test fails for darcs-1 repos
skip-formats darcs-1

mkdir temp1
cd temp1
darcs init
echo 0 > f
darcs add f
darcs record -am 00
cd ..

for r in a b c d; do
  darcs get temp1 temp_$r
  cd temp_$r;
  echo $r > f
  darcs record -am "patch:$r";
  cd ..
done

cd temp_d
darcs pull -a ../temp_a
darcs pull -a ../temp_b
darcs pull -a ../temp_c
cd ..
cd temp_c
darcs pull -a ../temp_a
darcs pull -a ../temp_b
echo rc > f
darcs record -a -m rc
cd ..
cd temp_d
darcs pull -a ../temp_c > log
not grep -i "no remote" log
not grep -i get_extra log
cd ..
