summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b982f8)
raw | patch | inline | side by side (parent: 5b982f8)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 9 Aug 2006 13:07:31 +0000 (15:07 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 9 Aug 2006 21:49:26 +0000 (14:49 -0700) |
Since there are no external calls left in merge-recur, we do not need
to set the environment variable GIT_INDEX_FILE all the time.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
to set the environment variable GIT_INDEX_FILE all the time.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
merge-recursive.c | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index b8b095179bfb581611ced221e1bdcca2b05a07b9..7a93dd9208afda607dfc69e1e749c087251be648 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
}
}
+static const char *current_index_file = NULL;
static const char *original_index_file;
static const char *temporary_index_file;
static int cache_dirty = 0;
{
/* flush temporary index */
struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
- int fd = hold_lock_file_for_update(lock, getenv("GIT_INDEX_FILE"));
+ int fd = hold_lock_file_for_update(lock, current_index_file);
if (fd < 0)
die("could not lock %s", lock->filename);
if (write_cache(fd, active_cache, active_nr) ||
close(fd) || commit_lock_file(lock))
- die ("unable to write %s", getenv("GIT_INDEX_FILE"));
+ die ("unable to write %s", current_index_file);
discard_cache();
cache_dirty = 0;
return 0;
static void setup_index(int temp)
{
- const char *idx = temp ? temporary_index_file: original_index_file;
+ current_index_file = temp ? temporary_index_file: original_index_file;
if (cache_dirty)
die("fatal: cache changed flush_cache();");
unlink(temporary_index_file);
- setenv("GIT_INDEX_FILE", idx, 1);
discard_cache();
}
{
struct cache_entry *ce;
if (!cache_dirty)
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty++;
ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage, refresh);
if (!ce)
struct unpack_trees_options opts;
if (!cache_dirty) {
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty = 1;
}
return NULL;
}
} else
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
if (!active_cache_tree)
active_cache_tree = cache_tree();
unmerged->strdup_paths = 1;
if (!cache_dirty) {
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty++;
}
for (i = 0; i < active_nr; i++) {
return ret;
}
-/*
- * TODO: once we no longer call external programs, we'd probably be better off
- * not setting / getting the environment variable GIT_INDEX_FILE all the time.
- */
int remove_file(int clean, const char *path)
{
int update_cache = index_only || clean;
if (update_cache) {
if (!cache_dirty)
- read_cache_from(getenv("GIT_INDEX_FILE"));
+ read_cache_from(current_index_file);
cache_dirty++;
if (remove_file_from_cache(path))
return -1;