Fix dirp loop bug.

dirp was being calculated wrongly, which led to the metadata for real
paths being squashed. The test has been reverted to its original state
and the bug fixed.
Revert change to how lines are printed since it breaks tests.

This should *probably* be updated for new graft path functionality, but
how that should be done is an open question.