summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-29 16:53:20 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-29 16:53:20 (GMT)
commitdddafffef66041689f54837ac8e9bf717bb057b4 (patch)
treede95245da4f8fa0951b23190bccfb18a63f9ce12
parentcca7081a93b192219e8f4f7252c7fc7c2cabfd9a (diff)
downloadgit-dddafffef66041689f54837ac8e9bf717bb057b4.zip
git-dddafffef66041689f54837ac8e9bf717bb057b4.tar.gz
git-dddafffef66041689f54837ac8e9bf717bb057b4.tar.bz2
Re-instate dry-run logic in git-unpack-objects
It can no longer be as verbose, since it doesn't have a good way to resolve deltas (now that it is purely streaming, it cannot seek around to read the objects a delta is based on). But it can check that the thing unpacks cleanly at least as far as pack syntax goes - all the objects uncompress cleanly, and the pack has the right final SHA1.
-rw-r--r--unpack-objects.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/unpack-objects.c b/unpack-objects.c
index 0d15c00..97d2681 100644
--- a/unpack-objects.c
+++ b/unpack-objects.c
@@ -155,7 +155,8 @@ static int unpack_non_delta_entry(enum object_type kind, unsigned long size)
case OBJ_TAG: type = "tag"; break;
default: die("bad type %d", kind);
}
- write_object(buf, size, type);
+ if (!dry_run)
+ write_object(buf, size, type);
free(buf);
return 0;
}
@@ -171,6 +172,10 @@ static int unpack_delta_entry(unsigned long delta_size)
use(20);
delta_data = get_data(delta_size);
+ if (dry_run) {
+ free(delta_data);
+ return 0;
+ }
if (!has_sha1_file(base_sha1)) {
add_delta_to_list(base_sha1, delta_data, delta_size);