diff options
Diffstat (limited to 'lockfile.c')
-rw-r--r-- | lockfile.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lockfile.c b/lockfile.c index 2023ebb6ff..bed6b21daf 100644 --- a/lockfile.c +++ b/lockfile.c @@ -4,6 +4,7 @@ #include "cache.h" static struct lock_file *lock_file_list; +static const char *alternate_index_output; static void remove_lock_file(void) { @@ -70,11 +71,15 @@ int hold_locked_index(struct lock_file *lk, int die_on_error) return hold_lock_file_for_update(lk, get_index_file(), die_on_error); } +void set_alternate_index_output(const char *name) +{ + alternate_index_output = name; +} + int commit_locked_index(struct lock_file *lk) { - char *output = getenv(INDEX_OUTPUT_ENVIRONMENT); - if (output && *output) { - int result = rename(lk->filename, output); + if (alternate_index_output) { + int result = rename(lk->filename, alternate_index_output); lk->filename[0] = 0; return result; } |