I started out calling the tool "dircache". That's clearly moronic.
Another way of saying the same thing: "git" itself only handles content
integrity, the trust has to come from outside.
- Current Directory Cache (".dircache/index")
+ Current Directory Cache (".git/index")
The "current directory cache" is a simple binary file, which contains an
efficient representation of a virtual directory content at some random
unsigned int active_nr, active_alloc;
#define DB_ENVIRONMENT "SHA1_FILE_DIRECTORY"
-#define DEFAULT_DB_ENVIRONMENT ".dircache/objects"
+#define DEFAULT_DB_ENVIRONMENT ".git/objects"
#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
#define ce_size(ce) cache_entry_size((ce)->namelen)
char *sha1_dir = getenv(DB_ENVIRONMENT), *path;
int len, i;
- if (mkdir(".dircache", 0755) < 0) {
- perror("unable to create .dircache");
+ if (mkdir(".git", 0755) < 0) {
+ perror("unable to create .git directory");
exit(1);
}
sha1_file_directory = DEFAULT_DB_ENVIRONMENT;
if (access(sha1_file_directory, X_OK) < 0)
return error("no access to SHA1 file directory");
- fd = open(".dircache/index", O_RDONLY);
+ fd = open(".git/index", O_RDONLY);
if (fd < 0)
return (errno == ENOENT) ? 0 : error("open failed");
static void remove_lock_file(void)
{
if (remove_lock)
- unlink(".dircache/index.lock");
+ unlink(".git/index.lock");
}
int main(int argc, char **argv)
int i, newfd;
unsigned char sha1[20];
- newfd = open(".dircache/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
+ newfd = open(".git/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
if (newfd < 0)
usage("unable to create new cachefile");
atexit(remove_lock_file);
usage("failed to unpack tree object %s", arg);
}
if (write_cache(newfd, active_cache, active_nr) ||
- rename(".dircache/index.lock", ".dircache/index"))
+ rename(".git/index.lock", ".git/index"))
usage("unable to write new index file");
remove_lock = 0;
return 0;
/*
* We fundamentally don't like some paths: we don't want
* dot or dot-dot anywhere, and in fact, we don't even want
- * any other dot-files (.dircache or anything else). They
+ * any other dot-files (.git or anything else). They
* are hidden, for chist sake.
*
* Also, we don't want double slashes or slashes at the
static void remove_lock_file(void)
{
if (remove_lock)
- unlink(".dircache/index.lock");
+ unlink(".git/index.lock");
}
int main(int argc, char **argv)
int i, newfd, entries;
int allow_options = 1;
- newfd = open(".dircache/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
+ newfd = open(".git/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
if (newfd < 0)
usage("unable to create new cachefile");
usage("Unable to add %s to database", path);
}
if (write_cache(newfd, active_cache, active_nr) ||
- rename(".dircache/index.lock", ".dircache/index"))
+ rename(".git/index.lock", ".git/index"))
usage("Unable to write new cachefile");
remove_lock = 0;