Create $GIT_DIR/objects/pack if missing during renameAndOpenPack
Its OK for the objects/pack directory to be missing, an empty
repository doesn't have to have it. C Git's `git repack` will
automatically create the directory if it is not present, so we
need to do the same behavior here.
When the directory doesn't exist, we try to create it, but we
may have creation fail if another concurrent thread/process also
made the directory at the same time, hence we test once more after
creation failure before throwing the exception.
Found-by: Mark Struberg <struberg@yahoo.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>