Skip to content

Commit 4bb04f2

Browse files
author
Linus Torvalds
committed
Rename ".dircache" directory to ".git"
I started out calling the tool "dircache". That's clearly moronic.
1 parent 9614b8d commit 4bb04f2

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ it's not something "git" does for you.
122122
Another way of saying the same thing: "git" itself only handles content
123123
integrity, the trust has to come from outside.
124124

125-
Current Directory Cache (".dircache/index")
125+
Current Directory Cache (".git/index")
126126

127127
The "current directory cache" is a simple binary file, which contains an
128128
efficient representation of a virtual directory content at some random

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct cache_entry **active_cache;
6464
unsigned int active_nr, active_alloc;
6565

6666
#define DB_ENVIRONMENT "SHA1_FILE_DIRECTORY"
67-
#define DEFAULT_DB_ENVIRONMENT ".dircache/objects"
67+
#define DEFAULT_DB_ENVIRONMENT ".git/objects"
6868

6969
#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
7070
#define ce_size(ce) cache_entry_size((ce)->namelen)

init-db.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ int main(int argc, char **argv)
1010
char *sha1_dir = getenv(DB_ENVIRONMENT), *path;
1111
int len, i;
1212

13-
if (mkdir(".dircache", 0755) < 0) {
14-
perror("unable to create .dircache");
13+
if (mkdir(".git", 0755) < 0) {
14+
perror("unable to create .git directory");
1515
exit(1);
1616
}
1717

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ int read_cache(void)
364364
sha1_file_directory = DEFAULT_DB_ENVIRONMENT;
365365
if (access(sha1_file_directory, X_OK) < 0)
366366
return error("no access to SHA1 file directory");
367-
fd = open(".dircache/index", O_RDONLY);
367+
fd = open(".git/index", O_RDONLY);
368368
if (fd < 0)
369369
return (errno == ENOENT) ? 0 : error("open failed");
370370

read-tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ static int remove_lock = 0;
6868
static void remove_lock_file(void)
6969
{
7070
if (remove_lock)
71-
unlink(".dircache/index.lock");
71+
unlink(".git/index.lock");
7272
}
7373

7474
int main(int argc, char **argv)
7575
{
7676
int i, newfd;
7777
unsigned char sha1[20];
7878

79-
newfd = open(".dircache/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
79+
newfd = open(".git/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
8080
if (newfd < 0)
8181
usage("unable to create new cachefile");
8282
atexit(remove_lock_file);
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
9999
usage("failed to unpack tree object %s", arg);
100100
}
101101
if (write_cache(newfd, active_cache, active_nr) ||
102-
rename(".dircache/index.lock", ".dircache/index"))
102+
rename(".git/index.lock", ".git/index"))
103103
usage("unable to write new index file");
104104
remove_lock = 0;
105105
return 0;

update-cache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static void refresh_cache(void)
205205
/*
206206
* We fundamentally don't like some paths: we don't want
207207
* dot or dot-dot anywhere, and in fact, we don't even want
208-
* any other dot-files (.dircache or anything else). They
208+
* any other dot-files (.git or anything else). They
209209
* are hidden, for chist sake.
210210
*
211211
* Also, we don't want double slashes or slashes at the
@@ -235,15 +235,15 @@ static int remove_lock = 0;
235235
static void remove_lock_file(void)
236236
{
237237
if (remove_lock)
238-
unlink(".dircache/index.lock");
238+
unlink(".git/index.lock");
239239
}
240240

241241
int main(int argc, char **argv)
242242
{
243243
int i, newfd, entries;
244244
int allow_options = 1;
245245

246-
newfd = open(".dircache/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
246+
newfd = open(".git/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
247247
if (newfd < 0)
248248
usage("unable to create new cachefile");
249249

@@ -284,7 +284,7 @@ int main(int argc, char **argv)
284284
usage("Unable to add %s to database", path);
285285
}
286286
if (write_cache(newfd, active_cache, active_nr) ||
287-
rename(".dircache/index.lock", ".dircache/index"))
287+
rename(".git/index.lock", ".git/index"))
288288
usage("Unable to write new cachefile");
289289

290290
remove_lock = 0;

0 commit comments

Comments
 (0)