From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] Create object subdirectories on demand (phase II)
Date: Fri, 07 Oct 2005 09:30:48 -0700 [thread overview]
Message-ID: <7vll155lxj.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 7vfyrd7jll.fsf@assigned-by-dhcp.cox.net
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>
---
Here is what I did. I unoptimized your original and that
sits near the tip of "pu" branch. This patch is to revert
the unoptimization. In addition, git-prune is told about
the empty fan-out removal, although it may not matter that
much. Hopefully, the phase I can be included in the next
official release, and after everybody updates, this patch
can go in.
git-prune.sh | 1 +
init-db.c | 4 ----
prune-packed.c | 3 +--
t/t0000-basic.sh | 8 ++++----
4 files changed, 6 insertions(+), 10 deletions(-)
applies-to: d672cb30d513553ea3ca92a933563a25df1d7865
93638ce0a569543d0b41eedfac6873a541f5c753
diff --git a/git-prune.sh b/git-prune.sh
index 9657dbf..b28630c 100755
--- a/git-prune.sh
+++ b/git-prune.sh
@@ -22,6 +22,7 @@ sed -ne '/unreachable /{
}' | {
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 aabc09f..921df9b 100644
--- a/init-db.c
+++ b/init-db.c
@@ -244,10 +244,6 @@ int main(int argc, char **argv)
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 73f0f3a..16685d1 100644
--- a/prune-packed.c
+++ b/prune-packed.c
@@ -27,8 +27,7 @@ static void prune_dir(int i, DIR *dir, 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 5c5f854..dff7d69 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -28,12 +28,12 @@ test_expect_success \
'.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
---
0.99.8.GIT
next prev parent reply other threads:[~2005-10-07 16:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-06 23:23 Create object subdirectories on demand Linus Torvalds
2005-10-07 9:38 ` Junio C Hamano
2005-10-07 14:56 ` Linus Torvalds
2005-10-07 16:30 ` Junio C Hamano [this message]
2005-10-08 1:45 ` Daniel Barkalow
2005-10-09 10:42 ` Use the same move_temp_to_file in git-http-fetch Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vll155lxj.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox