redo icon indicating copy to clipboard operation
redo copied to clipboard

Redo gets confused with multiple files with same contents

Open zdule opened this issue 8 years ago • 1 comments

Just noticed something

If a target depends on two files which happen to have the same contents, changing one of them might not cause a rebuild.

Here's a small example Two empty files are created a and b, and concat.do is created to concatenate them:

redo-ifchange a b
echo "File a:" > $3
cat a >> $3
echo "\nFile b:">> $3
cat b >> $3

If you redo target concat and than change file a, redo won't notice the change.

This might be a rare and degenerate example and might not be worth fixing.

zdule avatar Jul 17 '16 19:07 zdule

This version of redo stores hash information for targets within files (inside of a .redo directory) named with the hash of the contents. So if dependencies a and b both have the same contents, then they will share a .redo file with the filename being the hash of their contents (ie. something like ab20482feed). Since two different targets are using the same metadata file, I am not surprised by the issues you are having.

I would recommend using either this version of redo implemented in Haskell, or this version implemented in python, both which solve this problem.

dinkelk avatar Jul 24 '16 22:07 dinkelk