2 * GIT - The information manager from hell
4 * Copyright (C) Linus Torvalds, 2005
8 void safe_create_dir(const char *dir
)
10 if (mkdir(dir
, 0755) < 0) {
11 if (errno
!= EEXIST
) {
19 * If you want to, you can share the DB area with any number of branches.
20 * That has advantages: you can save space by sharing all the SHA1 objects.
21 * On the other hand, it might just make lookup slower and messier. You
22 * be the judge. The default case is to have one DB per managed directory.
24 int main(int argc
, char **argv
)
30 safe_create_dir(".git");
32 sha1_dir
= gitenv(DB_ENVIRONMENT
);
34 sha1_dir
= DEFAULT_DB_ENVIRONMENT
;
35 fprintf(stderr
, "defaulting to local storage area\n");
37 len
= strlen(sha1_dir
);
38 path
= xmalloc(len
+ 40);
39 memcpy(path
, sha1_dir
, len
);
41 safe_create_dir(sha1_dir
);
42 for (i
= 0; i
< 256; i
++) {
43 sprintf(path
+len
, "/%02x", i
);
44 safe_create_dir(path
);