add rename

For git objects and references, fs-db can now write to a temporary
file, and when it is ready 'rename' it into place, which avoids
exposing partially written files or truncating a file if the program
exits at the wrong time.  This avoids creating the target directory if
the old and new path are identical.
code style/callback cleanup

Making this consistent with the style in other modules, and for good
reason mkdirp was missing a return on a callback which would fall
out to make a second callback.