summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1aaa5d)
raw | patch | inline | side by side (parent: c1aaa5d)
author | Linus Torvalds <torvalds@osdl.org> | |
Sun, 9 Oct 2005 09:30:17 +0000 (02:30 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 28 Oct 2005 09:01:42 +0000 (02:01 -0700) |
This removes the unoptimization. The previous round does not mind
missing fan-out directories, but still makes sure they exist, lest
older versions choke on a repository created/packed by it.
This round does not play that nicely anymore -- empty fan-out
directories are not created by init-db, and will stay removed by
prune-packed. The prune command also removes empty fan-out directories.
Signed-off-by: Junio C Hamano <junkio@cox.net>
missing fan-out directories, but still makes sure they exist, lest
older versions choke on a repository created/packed by it.
This round does not play that nicely anymore -- empty fan-out
directories are not created by init-db, and will stay removed by
prune-packed. The prune command also removes empty fan-out directories.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-prune.sh | patch | blob | history | |
init-db.c | patch | blob | history | |
prune-packed.c | patch | blob | history | |
t/t0000-basic.sh | patch | blob | history |
diff --git a/git-prune.sh b/git-prune.sh
index 9657dbf2711e40bfe035a22ec211811c88c89e8e..b28630cacfa035106b7980b395fc9c1f9b1509d1 100755 (executable)
--- a/git-prune.sh
+++ b/git-prune.sh
}' | {
cd "$GIT_OBJECT_DIRECTORY" || exit
xargs $echo rm -f
+ rmdir 2>/dev/null [0-9a-f][0-9a-f]
}
git-prune-packed $dryrun
diff --git a/init-db.c b/init-db.c
index 2a4aa3c1965f0e2323a1ec3a4f66c0c1206c7d31..ca6fa4d4200faaf208e5c6c5af5f009cc4432a09 100644 (file)
--- a/init-db.c
+++ b/init-db.c
memcpy(path, sha1_dir, len);
safe_create_dir(sha1_dir);
- for (i = 0; i < 256; i++) {
- sprintf(path+len, "/%02x", i);
- safe_create_dir(path);
- }
strcpy(path+len, "/pack");
safe_create_dir(path);
strcpy(path+len, "/info");
diff --git a/prune-packed.c b/prune-packed.c
index 1e0fc0cd9e9694c0bad54e26367097cc499bf3d2..16685d1d8b25358f8df45a92262b4b0f6ea9cef5 100644 (file)
--- a/prune-packed.c
+++ b/prune-packed.c
error("unable to unlink %s", pathname);
}
pathname[len] = 0;
- if (!rmdir(pathname))
- mkdir(pathname, 0777);
+ rmdir(pathname);
}
static void prune_packed_objects(void)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 5c5f854858522f15f929d9a9320ee9c310d0b634..dff7d6916374d6f1c9302970cef7d0ab7e0c75ad 100755 (executable)
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
'.git/objects should be empty after git-init-db in an empty repo.' \
'cmp -s /dev/null should-be-empty'
-# also it should have 258 subdirectories; 256 fan-out anymore, pack, and info.
-# 259 is counting "objects" itself
+# also it should have 2 subdirectories; no fan-out anymore, pack, and info.
+# 3 is counting "objects" itself
find .git/objects -type d -print >full-of-directories
test_expect_success \
- '.git/objects should have 258 subdirectories.' \
- 'test $(wc -l < full-of-directories) = 259'
+ '.git/objects should have 3 subdirectories.' \
+ 'test $(wc -l < full-of-directories) = 3'
################################################################
# Basics of the basics