summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-12 19:33:16 -0700
committerJunio C Hamano <junkio@cox.net>2006-08-12 19:33:16 -0700
commit647377c4c91064fc5001acddd5357467c0da6ef9 (patch)
treeef5ee52aaf3b2f0b8e070153b47b9248aa32eed5 /builtin-pack-objects.c
parenteb4541569d4fdfb1cbdf503cfbf433e63d79b663 (diff)
parent8e27364128b091e76059229d4f009bc7f869fa9f (diff)
downloadgit-647377c4c91064fc5001acddd5357467c0da6ef9.tar.gz
Merge branch 'jc/pack-objects'
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 2301cd5c0f..2f9921224d 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -270,6 +270,22 @@ static unsigned long write_object(struct sha1file *f,
* and we do not need to deltify it.
*/
+ if (!entry->in_pack && !entry->delta) {
+ unsigned char *map;
+ unsigned long mapsize;
+ map = map_sha1_file(entry->sha1, &mapsize);
+ if (map && !legacy_loose_object(map)) {
+ /* We can copy straight into the pack file */
+ sha1write(f, map, mapsize);
+ munmap(map, mapsize);
+ written++;
+ reused++;
+ return mapsize;
+ }
+ if (map)
+ munmap(map, mapsize);
+ }
+
if (! to_reuse) {
buf = read_sha1_file(entry->sha1, type, &size);
if (!buf)