[#2338] Add method to find the temporary directory

The code is essentially borrowed from clar/sandbox.h:find_tmp_path,
mainly removing the CLAR_TMP as a valid environment variable.
[#2338] Save the index path in the indexer object

Store the path prefix which is passed to git_indexer_new() in the newly
created indexer instance. That way, we don't need to rely on the value
of git_pack_file.pack_name in git_indexer_commit() and can use the path
directly.
[#2338] Store the temporary packfile in /tmp.

Now that we know how to find the location of system temporary directory
and since the indexer no longer relies on the location of the packfile
to determine where the index is supposed to reside, we can finally move
the temporary packfile where it belongs, to the temporary directory.

A side effect of this change is that it fixes the problem of writing to
descriptor and reading from mapped region which is specific to remote
filesystems on Windows.