[Not A PATCH v2 02/11] interdiff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is an interdiff for 02/11 from the earlier round.

As oi->u.packed.delta is renamed to is_delta, and oi->want_deltainfo is
lost with this change, the later patches have necessary adjustments but
they are all trivial so I wouldn't be spamming the list with the interdiff
for them since the first round.

---
 cache.h     |    5 ++---
 sha1_file.c |   30 +++++++++---------------------
 2 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/cache.h b/cache.h
index dfd2d61..9fbc07e 100644
--- a/cache.h
+++ b/cache.h
@@ -1025,7 +1025,6 @@ extern int packed_object_info_detail(struct packed_git *, off_t, unsigned long *
 struct object_info {
 	/* Request */
 	unsigned long *sizep;
-	int want_deltainfo;
 
 	/* Response */
 	enum {
@@ -1043,9 +1042,9 @@ struct object_info {
 		 * } loose;
 		 */
 		struct {
-			off_t offset;
-			unsigned int delta;
 			struct packed_git *pack;
+			off_t offset;
+			unsigned int is_delta;
 		} packed;
 	} u;
 };
diff --git a/sha1_file.c b/sha1_file.c
index 9b16cd8..7eed316 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1481,7 +1481,7 @@ static off_t get_delta_base(struct packed_git *p,
 
 /* forward declaration for a mutually recursive function */
 static int packed_object_info(struct packed_git *p, off_t offset,
-			      unsigned long *sizep);
+			      unsigned long *sizep, int *rtype);
 
 static int packed_delta_info(struct packed_git *p,
 			     struct pack_window **w_curs,
@@ -1495,7 +1495,7 @@ static int packed_delta_info(struct packed_git *p,
 	base_offset = get_delta_base(p, w_curs, &curpos, type, obj_offset);
 	if (!base_offset)
 		return OBJ_BAD;
-	type = packed_object_info(p, base_offset, NULL);
+	type = packed_object_info(p, base_offset, NULL, NULL);
 	if (type <= OBJ_NONE) {
 		struct revindex_entry *revidx;
 		const unsigned char *base_sha1;
@@ -1605,7 +1605,7 @@ int packed_object_info_detail(struct packed_git *p,
 }
 
 static int packed_object_info(struct packed_git *p, off_t obj_offset,
-			      unsigned long *sizep)
+			      unsigned long *sizep, int *rtype)
 {
 	struct pack_window *w_curs = NULL;
 	unsigned long size;
@@ -1613,6 +1613,8 @@ static int packed_object_info(struct packed_git *p, off_t obj_offset,
 	enum object_type type;
 
 	type = unpack_object_header(p, &w_curs, &curpos, &size);
+	if (rtype)
+		*rtype = type; /* representation type */
 
 	switch (type) {
 	case OBJ_OFS_DELTA:
@@ -2098,7 +2100,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
 {
 	struct cached_object *co;
 	struct pack_entry e;
-	int status;
+	int status, rtype;
 
 	co = find_cached_object(sha1);
 	if (co) {
@@ -2122,22 +2124,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
 			return status;
 	}
 
-	if (!oi->want_deltainfo) {
-		status = packed_object_info(e.p, e.offset, oi->sizep);
-	} else {
-		unsigned long size, store_size;
-		unsigned int delta_chain_length;
-		unsigned char base_sha1[20];
-		status = packed_object_info_detail(e.p, e.offset,
-						   &size, &store_size,
-						   &delta_chain_length,
-						   base_sha1);
-		if (0 <= status) {
-			if (oi->sizep)
-				*oi->sizep = size;
-			oi->u.packed.delta = delta_chain_length;
-		}
-	}
+	status = packed_object_info(e.p, e.offset, oi->sizep, &rtype);
 	if (status < 0) {
 		mark_bad_packed_object(e.p, sha1);
 		status = sha1_object_info_extended(sha1, oi);
@@ -2145,6 +2132,8 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
 		oi->whence = OI_PACKED;
 		oi->u.packed.offset = e.offset;
 		oi->u.packed.pack = e.p;
+		oi->u.packed.is_delta = (rtype == OBJ_REF_DELTA ||
+					 rtype == OBJ_OFS_DELTA);
 	}
 
 	return status;
@@ -2155,7 +2144,6 @@ int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
 	struct object_info oi;
 
 	oi.sizep = sizep;
-	oi.want_deltainfo = 0;
 	return sha1_object_info_extended(sha1, &oi);
 }
 
-- 
1.7.5.1.416.gac10c8

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]