Ignore redundant edges

This is the second attempt at a fix for the issue brought up here: https://groups.google.com/forum/?fromgroups=#!topic/ninja-build/CNqaIwlTgVo

Previous attempt was here: martine/ninja/pull/516

The minified version of the repro:
```
pool compile
  depth = 1
rule gen_foo
  command = touch foo.cpp
rule echo
  command = echo $out > $out
build foo.cpp.obj: echo foo.cpp || foo.cpp
  pool = compile
build libfoo.a: echo foo.cpp.obj
build foo.cpp: gen_foo
build all: phony libfoo.a
```

Will now build successfully :)

I generated recent chromium/ninja build manifests, and it seems to build fine as well (build is in progress).