diff options
author | Linus Torvalds <torvalds@osdl.org> | 2005-10-08 15:54:01 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-10-08 15:54:01 -0700 |
commit | 230f13225df8b7e7eb0acc91a8c630f9e84967c1 (patch) | |
tree | c56ceaea7e1d17816c2cefb8cb26bb22fa22bd0b /git-rename.perl | |
parent | 0d0b7c237af0846123bef73879d65a3e78a56461 (diff) | |
download | git-230f13225df8b7e7eb0acc91a8c630f9e84967c1.tar.gz git-230f13225df8b7e7eb0acc91a8c630f9e84967c1.tar.xz |
Create object subdirectories on demand
This makes it possible to have a "sparse" git object subdirectory
structure, something that has become much more attractive now that people
use pack-files all the time.
As a result of pack-files, a git object directory doesn't necessarily have
any individual objects lying around, and in that case it's just wasting
space to keep the empty first-level object directories around: on many
filesystems the 256 empty directories will be aboue 1MB of diskspace.
Even more importantly, after you re-pack a project that _used_ to be
unpacked, you could be left with huge directories that no longer contain
anything, but that waste space and take time to look through.
With this change, "git prune-packed" can just do an rmdir() on the
directories, and they'll get removed if empty, and re-created on demand.
This patch also tries to fix up "write_sha1_from_fd()" to use the new
common infrastructure for creating the object files, closing a hole where
we might otherwise leave half-written objects in the object database.
[jc: I unoptimized the part that really removes the fan-out directories
to ease transition. init-db still wastes 1MB of diskspace to hold 256
empty fan-outs, and prune-packed rmdir()'s the grown but empty directories,
but runs mkdir() immediately after that -- reducing the saving from 150KB
to 146KB. These parts will be re-introduced when everybody has the
on-demand capability.]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-rename.perl')
-rwxr-xr-x | git-rename.perl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/git-rename.perl b/git-rename.perl index a28c8c83b..3b1127b1b 100755 --- a/git-rename.perl +++ b/git-rename.perl @@ -15,7 +15,7 @@ sub usage($); my $GIT_DIR = $ENV{'GIT_DIR'} || ".git"; unless ( -d $GIT_DIR && -d $GIT_DIR . "/objects" && - -d $GIT_DIR . "/objects/00" && -d $GIT_DIR . "/refs") { + -d $GIT_DIR . "/objects/" && -d $GIT_DIR . "/refs") { usage("Git repository not found."); } |