Improved Index and TemporaryIndex initialization
commitdacb384ab1b7ca366ef6155361541b54d1aab7ce
authorPeter Grayson <pete@jpgrayson.net>
Fri, 23 Apr 2021 17:06:40 +0000 (23 13:06 -0400)
committerPeter Grayson <pete@jpgrayson.net>
Fri, 23 Apr 2021 22:23:23 +0000 (23 18:23 -0400)
tree92c204f2530b58621d77466de6d182ad26692d89
parentbad9cf7e5e7682ea05b5e80c198fc956322f8906
Improved Index and TemporaryIndex initialization

Index now takes responsibility (instead of Repository) for interpreting
GIT_INDEX_FILE and knowing the default index file name ('index').

The new TemporaryIndex class implements the context manager protocol such
that it can auto-delete its temporary index file when leaving a context.

Also, temporary indexes now use a monotonic timestamp instead of a Python
object id to name the temporary index file. This is possibly more robust
against an object address being reused as well as avoiding leaking a memory
address to the outside world.

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
stgit/commands/refresh.py
stgit/lib/git/iw.py
stgit/lib/git/repository.py