Re: RFC: Allow missing objects during packing

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Nicolas Pitre
Date: Monday, August 11, 2008 - 9:44 pm

On Mon, 11 Aug 2008, Shawn O. Pearce wrote:


If you're going to die anyway due to an object with unknown type, better 
do so _before_ going through the delta search phase and leaving a 
partial pack behind.  IOW, the type check can be performed in 
prepare_pack() instead of write_object() like:

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 2dadec1..01ab49c 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1722,8 +1733,12 @@ static void prepare_pack(int window, int depth)
 		if (entry->no_try_delta)
 			continue;
 
-		if (!entry->preferred_base)
+		if (!entry->preferred_base) {
 			nr_deltas++;
+			if (entry->type < 0)
+				die("unable to get type of object %s",
+				    sha1_to_hex(entry->idx.sha1));
+		}
 
 		delta_list[n++] = entry;
 	}

Also a comment in check_object() mentioning where the return value of 
sha1_object_info() is verified would be in order.

And I also agree with Junio about a test script for this so the usage is 
fully demonstrated, and to ensure it keeps on working as intended 
(most people will simply never exercise this otherwise).


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
RFC: Allow missing objects during packing, Shawn O. Pearce, (Mon Aug 11, 11:28 am)
Re: RFC: Allow missing objects during packing, Junio C Hamano, (Mon Aug 11, 3:39 pm)
Re: RFC: Allow missing objects during packing, Shawn O. Pearce, (Mon Aug 11, 3:44 pm)
Re: RFC: Allow missing objects during packing, Shawn O. Pearce, (Mon Aug 11, 6:28 pm)
Re: RFC: Allow missing objects during packing, Junio C Hamano, (Mon Aug 11, 7:08 pm)
Re: RFC: Allow missing objects during packing, Nicolas Pitre, (Mon Aug 11, 9:44 pm)
Re: [PATCH] pack-objects: Allow missing base objects when ..., Shawn O. Pearce, (Tue Aug 12, 11:18 am)