summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03ac6e6)
raw | patch | inline | side by side (parent: 03ac6e6)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 24 Apr 2006 07:23:54 +0000 (00:23 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 24 Apr 2006 07:26:31 +0000 (00:26 -0700) |
Signed-off-by: Junio C Hamano <junkio@cox.net>
update-index.c | patch | blob | history |
diff --git a/update-index.c b/update-index.c
index 1efac27c6baf26ed881099e91a3cbd5dbb3c2289..86f53948fceaa93fb928323e6fba737510cec86a 100644 (file)
--- a/update-index.c
+++ b/update-index.c
#include "cache.h"
#include "strbuf.h"
#include "quote.h"
+#include "tree.h"
+#include "cache-tree.h"
+
+static unsigned char active_cache_sha1[20];
+static struct cache_tree *active_cache_tree;
/*
* Default to not allowing changes to the list of files. The
active_cache[pos]->ce_flags &= ~htons(CE_VALID);
break;
}
+ cache_tree_invalidate_path(active_cache_tree, path);
active_cache_changed = 1;
return 0;
}
struct stat st;
status = lstat(path, &st);
+
+ /* We probably want to do this in remove_file_from_cache() and
+ * add_cache_entry() instead...
+ */
+ cache_tree_invalidate_path(active_cache_tree, path);
+
if (status < 0 || S_ISDIR(st.st_mode)) {
/* When we used to have "path" and now we want to add
* "path/file", we need a way to remove "path" before
return error("%s: cannot add to the index - missing --add option?",
path);
report("add '%s'", path);
+ cache_tree_invalidate_path(active_cache_tree, path);
return 0;
}
default:
return -1;
}
+ cache_tree_invalidate_path(active_cache_tree, path);
active_cache_changed = 1;
return 0;
}
die("Unable to mark file %s", path);
return;
}
+ cache_tree_invalidate_path(active_cache_tree, path);
if (force_remove) {
if (remove_file_from_cache(p))
free(path_name);
continue;
}
+ cache_tree_invalidate_path(active_cache_tree, path_name);
if (!mode) {
/* mode == 0 means there is no such path -- remove */
if (newfd < 0)
die("unable to create new cachefile");
- entries = read_cache();
+ entries = read_cache_1(active_cache_sha1);
if (entries < 0)
die("cache corrupted");
+ active_cache_tree = read_cache_tree(active_cache_sha1);
for (i = 1 ; i < argc; i++) {
const char *path = argv[i];
}
}
if (active_cache_changed) {
- if (write_cache(newfd, active_cache, active_nr) ||
+ if (write_cache_1(newfd, active_cache, active_nr,
+ active_cache_sha1) ||
commit_index_file(&cache_file))
die("Unable to write new cachefile");
+ write_cache_tree(active_cache_sha1, active_cache_tree);
}
return has_errors ? 1 : 0;