Do not calculate checksums of directories.

Summary: Add a condition to avoid calculating the checksum of a directory and add corresponding unit tests.

Test Plan: Ensure unit tests pass.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5018