Fix edge case when rel path changes from file to dir

This fixes an edge case in gitfs where a path that once was a file is
now a directory.
Merge pull request #11281 from terminalmage/issue11181-2014.1

Fix edge case when rel path changes from file to dir (2014.1 branch)