git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add description of OFS_DELTA to the pack format description
@ 2008-04-06 13:47 Peter Eriksen
  2008-04-06 19:07 ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Eriksen @ 2008-04-06 13:47 UTC (permalink / raw)
  To: git



Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
---

I'll take it in smaller steps this time.

 Documentation/technical/pack-format.txt |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt
index aa87756..f6b1405 100644
--- a/Documentation/technical/pack-format.txt
+++ b/Documentation/technical/pack-format.txt
@@ -103,10 +103,20 @@ Pack file entry: <+
      packed object data:
         If it is not DELTA, then deflated bytes (the size above
 		is the size before compression).
-	If it is DELTA, then
+	If it is REF_DELTA, then
 	  20-byte base object name SHA1 (the size above is the
 		size of the delta data that follows).
           delta data, deflated.
+	If it is OFS_DELTA, then
+	  n-byte offset (see below) (the size above is the
+		size of the delta data that follows).
+          delta data, deflated.
+
+     offset encoding:
+          n bytes with MSB set in all but the last one.
+          The offset is then the number constructed by
+          concatenating the lower 7 bit of each byte, and
+          adding 2^7 + 2^14 + ... + 2^(7*(n-1)) to the result.
 
 
 = Version 2 pack-*.idx files support packs larger than 4 GiB, and
-- 
1.5.5-rc3.GIT

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Add description of OFS_DELTA to the pack format description
  2008-04-06 13:47 [PATCH] Add description of OFS_DELTA to the pack format description Peter Eriksen
@ 2008-04-06 19:07 ` Shawn O. Pearce
  2008-04-06 20:19   ` [PATCH v2] " Peter Eriksen
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-04-06 19:07 UTC (permalink / raw)
  To: Peter Eriksen; +Cc: git

Peter Eriksen <s022018@student.dtu.dk> wrote:
> diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt
> index aa87756..f6b1405 100644
> --- a/Documentation/technical/pack-format.txt
> +++ b/Documentation/technical/pack-format.txt
> @@ -103,10 +103,20 @@ Pack file entry: <+
>       packed object data:
>          If it is not DELTA, then deflated bytes (the size above
>  		is the size before compression).
> -	If it is DELTA, then
> +	If it is REF_DELTA, then
>  	  20-byte base object name SHA1 (the size above is the
>  		size of the delta data that follows).
>            delta data, deflated.
> +	If it is OFS_DELTA, then
> +	  n-byte offset (see below) (the size above is the
> +		size of the delta data that follows).
> +          delta data, deflated.

You are missing the description that the position within _this_
packfile is determined by:

	offset_of_type_byte - n_byte_offset

The above can still be taken to mean the offset is from the start
of the packfile or something like that.

> +     offset encoding:
> +          n bytes with MSB set in all but the last one.
> +          The offset is then the number constructed by
> +          concatenating the lower 7 bit of each byte, and
> +          adding 2^7 + 2^14 + ... + 2^(7*(n-1)) to the result.

Hmm.  I've just spent 5 minutes reading this and I'm still not
certain what the result is.  2^0 only gets added to the result if
there is at least 2 bytes of data in the offset encoding; in your
description above it sounds like we should add 2^0 (1) even when
there is only 1 offset byte (n=1), which is not correct.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] Add description of OFS_DELTA to the pack format description
  2008-04-06 19:07 ` Shawn O. Pearce
@ 2008-04-06 20:19   ` Peter Eriksen
  2008-04-06 20:28     ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Eriksen @ 2008-04-06 20:19 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git


Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
---
 Documentation/technical/pack-format.txt |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)


On Sun, Apr 06, 2008 at 03:07:24PM -0400, Shawn O. Pearce wrote:
...
> You are missing the description that the position within _this_
> packfile is determined by:
> 
> 	offset_of_type_byte - n_byte_offset
> 
> The above can still be taken to mean the offset is from the start
> of the packfile or something like that.

Yes, I misunderstood that.

Peter

diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt
index aa87756..953c7ee 100644
--- a/Documentation/technical/pack-format.txt
+++ b/Documentation/technical/pack-format.txt
@@ -103,10 +103,24 @@ Pack file entry: <+
      packed object data:
         If it is not DELTA, then deflated bytes (the size above
 		is the size before compression).
-	If it is DELTA, then
+	If it is REF_DELTA, then
 	  20-byte base object name SHA1 (the size above is the
 		size of the delta data that follows).
           delta data, deflated.
+	If it is OFS_DELTA, then
+	  n-byte offset (see below) counted from the type-byte
+                of the header of the ofs-delta entry.
+                (the size above is the size of the delta data
+                that follows).
+          delta data, deflated.
+
+     offset encoding:
+          n bytes with MSB set in all but the last one.
+          The offset is then the number constructed by
+          concatenating the lower 7 bit of each byte, and
+          for n >= 2 adding 2^7 + 2^14 + ... + 2^(7*(n-1))
+          to the result.
+          
 
 
 = Version 2 pack-*.idx files support packs larger than 4 GiB, and
-- 
1.5.5-rc3.GIT

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] Add description of OFS_DELTA to the pack format description
  2008-04-06 20:19   ` [PATCH v2] " Peter Eriksen
@ 2008-04-06 20:28     ` Shawn O. Pearce
  2008-04-06 20:51       ` [PATCH v3] " Peter Eriksen
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-04-06 20:28 UTC (permalink / raw)
  To: Peter Eriksen; +Cc: git

Peter Eriksen <s022018@student.dtu.dk> wrote:
> 
> diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt
> index aa87756..953c7ee 100644
> --- a/Documentation/technical/pack-format.txt
> +++ b/Documentation/technical/pack-format.txt
> @@ -103,10 +103,24 @@ Pack file entry: <+
>       packed object data:
>          If it is not DELTA, then deflated bytes (the size above
>  		is the size before compression).
> -	If it is DELTA, then
> +	If it is REF_DELTA, then
>  	  20-byte base object name SHA1 (the size above is the
>  		size of the delta data that follows).
>            delta data, deflated.
> +	If it is OFS_DELTA, then
> +	  n-byte offset (see below) counted from the type-byte
> +                of the header of the ofs-delta entry.

Except that only a positive offset value is here, as it is always
a treated as a negative offset (you can only refer to a base that
was before you, as that is the only way to know the base's offset
in the pack).

> +                (the size above is the size of the delta data
> +                that follows).
> +          delta data, deflated.
> +
> +     offset encoding:
> +          n bytes with MSB set in all but the last one.
> +          The offset is then the number constructed by
> +          concatenating the lower 7 bit of each byte, and
> +          for n >= 2 adding 2^7 + 2^14 + ... + 2^(7*(n-1))
> +          to the result.

Yes, that sounds correct.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3] Add description of OFS_DELTA to the pack format description
  2008-04-06 20:28     ` Shawn O. Pearce
@ 2008-04-06 20:51       ` Peter Eriksen
  2008-04-06 22:26         ` Shawn O. Pearce
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Eriksen @ 2008-04-06 20:51 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git


Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
---
 Documentation/technical/pack-format.txt |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/Documentation/technical/pack-format.txt b/Documentation/technical/pack-format.txt
index aa87756..6b2170f 100644
--- a/Documentation/technical/pack-format.txt
+++ b/Documentation/technical/pack-format.txt
@@ -103,10 +103,24 @@ Pack file entry: <+
      packed object data:
         If it is not DELTA, then deflated bytes (the size above
 		is the size before compression).
-	If it is DELTA, then
+	If it is REF_DELTA, then
 	  20-byte base object name SHA1 (the size above is the
 		size of the delta data that follows).
           delta data, deflated.
+	If it is OFS_DELTA, then
+	  n-byte offset (see below) interpreted as a negative
+                offset from the type-byte of the header of the
+                ofs-delta entry (the size above is the size of
+                the delta data that follows).
+          delta data, deflated.
+
+     offset encoding:
+          n bytes with MSB set in all but the last one.
+          The offset is then the number constructed by
+          concatenating the lower 7 bit of each byte, and
+          for n >= 2 adding 2^7 + 2^14 + ... + 2^(7*(n-1))
+          to the result.
+          
 
 
 = Version 2 pack-*.idx files support packs larger than 4 GiB, and
-- 
1.5.5-rc3.GIT

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] Add description of OFS_DELTA to the pack format description
  2008-04-06 20:51       ` [PATCH v3] " Peter Eriksen
@ 2008-04-06 22:26         ` Shawn O. Pearce
  0 siblings, 0 replies; 6+ messages in thread
From: Shawn O. Pearce @ 2008-04-06 22:26 UTC (permalink / raw)
  To: Peter Eriksen; +Cc: git

Peter Eriksen <s022018@student.dtu.dk> wrote:
> -	If it is DELTA, then
> +	If it is REF_DELTA, then
>  	  20-byte base object name SHA1 (the size above is the
>  		size of the delta data that follows).
>            delta data, deflated.
> +	If it is OFS_DELTA, then
> +	  n-byte offset (see below) interpreted as a negative
> +                offset from the type-byte of the header of the
> +                ofs-delta entry (the size above is the size of
> +                the delta data that follows).
> +          delta data, deflated.
> +
> +     offset encoding:
> +          n bytes with MSB set in all but the last one.
> +          The offset is then the number constructed by
> +          concatenating the lower 7 bit of each byte, and
> +          for n >= 2 adding 2^7 + 2^14 + ... + 2^(7*(n-1))
> +          to the result.
> +          

Yup.  :-)

Acked-by: Shawn O. Pearce <spearce@spearce.org>

-- 
Shawn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-06 22:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-06 13:47 [PATCH] Add description of OFS_DELTA to the pack format description Peter Eriksen
2008-04-06 19:07 ` Shawn O. Pearce
2008-04-06 20:19   ` [PATCH v2] " Peter Eriksen
2008-04-06 20:28     ` Shawn O. Pearce
2008-04-06 20:51       ` [PATCH v3] " Peter Eriksen
2008-04-06 22:26         ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).