Subninja chdir: clean up logspam

Warnings would be spammed if a subninja (not a chdir) was used:
ninja: warning: Node "%s" not in a child of target %p ""

This fixes ResolveChdir() by first walking the target up the
tree to the next chdir or root node. This prevents the child
being searched for from flying past the target and hitting
the root node unexpectedly.

Change-Id: I1136d8432a2172e432023c48626270f21da51049
3 files changed