summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bb6b8e4)
raw | patch | inline | side by side (parent: bb6b8e4)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 17 Jul 2006 22:06:23 +0000 (15:06 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 25 Jul 2006 21:15:48 +0000 (14:15 -0700) |
When packing an object without deltifying, if the data is stored in
a loose object that is encoded with a new style header, copy it without
inflating and deflating.
Signed-off-by: Junio C Hamano <junkio@cox.net>
a loose object that is encoded with a new style header, copy it without
inflating and deflating.
Signed-off-by: Junio C Hamano <junkio@cox.net>
pack-objects.c | patch | blob | history |
diff --git a/pack-objects.c b/pack-objects.c
index 861c7f08ff1b68eee141442411b4706a1bcc2518..e52e9774e587872bf98a4254ea8cc1f949df130d 100644 (file)
--- a/pack-objects.c
+++ b/pack-objects.c
* 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)