Tolerate the situation of injecting nodes that already exist into an edgeless graph. This can happen if the previous Bazel command ends after an injection is planned, but before it happens, and the next build is edgeless (the first build could be edgeless too, doesn't matter).
Also make InMemoryNodeEntry#toString tolerant to not having deps.
PiperOrigin-RevId: 233152512
diff --git a/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java b/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java
index f72d069..bf76f6d 100644
--- a/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java
+++ b/src/main/java/com/google/devtools/build/skyframe/InMemoryNodeEntry.java
@@ -751,7 +751,11 @@
.add("value", value)
.add("lastChangedVersion", lastChangedVersion)
.add("lastEvaluatedVersion", lastEvaluatedVersion)
- .add("directDeps", isDone() ? GroupedList.create(directDeps) : directDeps)
+ .add(
+ "directDeps",
+ isDone() && keepEdges() != KeepEdgesPolicy.NONE
+ ? GroupedList.create(directDeps)
+ : directDeps)
.add("signaledDeps", signaledDeps)
.add("reverseDeps", ReverseDepsUtility.toString(this))
.add("dirtyBuildingState", dirtyBuildingState);