Paths like /foo/bar and //foo//bar shouldn't be handed to this function.  Callers cannot expect TreeWalk to handle foo//bar as foo/bar; foo//bar is bar within a subdirectory of no name, within foo.  Likewise with leading slashes.