Fix file truncation bug

This commix prevents files from being truncated when attempting to add
a hard-linked package which already exists inside the pool directory.
Test to avoid published file truncation when added to repo

This test will make sure that when a published file is added to repo, it
doesn't get truncated.