Replace a pair of patches with updated ones for subproject support.
[gitweb.git] / lockfile.c
index 2023ebb6ffa4642a49b46cbce99bd49d3befebb6..bed6b21daf302c76cb87bb99b613f168df9899e1 100644 (file)
@@ -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;
        }