#!/bin/sh -eu
# When invoked, redo-ood must output targets for which a dependency
# changed.

>all.do printf 'redo-ifchange a
'

>a.do cat <<EOF
redo-ifchange b
printf '0
'
EOF

>b printf '1
'

redo
<a read -r a1
<b read -r b1

ood1=$(redo-ood)

>b printf '2
'
<b read -r b2

ood2=$(redo-ood | sed /^all$/d)

test 0 -eq "${a1}"
test 1 -eq "${b1}"
test 2 -eq "${b2}"

[ "${ood1}" = "all" ]
test -n "${ood2}"

. ../stat_inode.rc

inode_a=$(stat_inode a)
inodes_ood=$(stat_inode "${ood2}")

test "${inode_a}" = "${inodes_ood}"
