Previously, when writing a repackaged jar, an attempt to write all of
an entry's parent directories would always be made, irrespective of
whether or not the entry itself had already been written. This was
inefficient as, due to the way that the jar is written, once an entry
itself has been written, we know that all of its parent directories
will also have been written.
This commit updates the jar writer so that no attempt is made to
write parent directory entries if the entry itself has already been
written.
Fixes gh-29175