summaryrefslogtreecommitdiff
path: root/lockfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-03-31 23:27:41 -0700
committerJunio C Hamano <junkio@cox.net>2007-04-03 23:44:32 -0700
commit5e7f56ac33f7a5583f9fa4e0b6088709fea7a6f8 (patch)
treea0a6896849d34635f947fabc82d8400c473f28b4 /lockfile.c
parent30ca07a249744e57163c02250fca420cea364299 (diff)
downloadgit-5e7f56ac33f7a5583f9fa4e0b6088709fea7a6f8.tar.gz
git-read-tree --index-output=<file>
This corrects the interface mistake of the previous one, and gives a command line parameter to the only plumbing command that currently needs it: "git-read-tree". We can add the calls to set_alternate_index_output() to other plumbing commands that update the index if/when needed. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'lockfile.c')
-rw-r--r--lockfile.c11
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;
}