git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pack-objects: document --delta-base-offset option
@ 2006-10-13  5:35 Junio C Hamano
  2006-10-13  5:35 ` [PATCH 2/2] git-repack: -b to pass --delta-base-offset Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2006-10-13  5:35 UTC (permalink / raw)
  To: GIT Mailing List; +Cc: Nicolas Pitre

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 Documentation/git-pack-objects.txt |   13 ++++++++++++-
 builtin-pack-objects.c             |    2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index d4661dd..5788709 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -9,7 +9,7 @@ git-pack-objects - Create a packed archi
 SYNOPSIS
 --------
 [verse]
-'git-pack-objects' [-q] [--no-reuse-delta] [--non-empty]
+'git-pack-objects' [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty]
 	[--local] [--incremental] [--window=N] [--depth=N]
 	[--revs [--unpacked | --all]*] [--stdout | base-name] < object-list
 
@@ -110,6 +110,17 @@ base-name::
 	This flag tells the command not to reuse existing deltas
 	but compute them from scratch.
 
+--delta-base-offset::
+	A packed archive can express base object of a delta as
+	either 20-byte object name or as an offset in the
+	stream, but older version of git does not understand the
+	latter.  By default, git-pack-objects only uses the
+	former format for better compatibility.  This option
+	allows the command to use the latter format for
+	compactness.  Depending on the average delta chain
+	length, this option typically shrinks the resulting
+	packfile by 3-5 per-cent.
+
 
 Author
 ------
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index ee5f031..41e1e74 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -15,7 +15,7 @@ #include "list-objects.h"
 #include <sys/time.h>
 #include <signal.h>
 
-static const char pack_usage[] = "git-pack-objects [-q] [--no-reuse-delta] [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] [--revs [--unpacked | --all]*] [--stdout | base-name] <ref-list | <object-list]";
+static const char pack_usage[] = "git-pack-objects [-q] [--no-reuse-delta] [--delta-base-offset] [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] [--revs [--unpacked | --all]*] [--stdout | base-name] <ref-list | <object-list]";
 
 struct object_entry {
 	unsigned char sha1[20];
-- 
1.4.3.rc2.g51ca

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

* [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13  5:35 [PATCH 1/2] pack-objects: document --delta-base-offset option Junio C Hamano
@ 2006-10-13  5:35 ` Junio C Hamano
  2006-10-13 13:20   ` Nicolas Pitre
  2006-10-13 18:05   ` Horst H. von Brand
  0 siblings, 2 replies; 10+ messages in thread
From: Junio C Hamano @ 2006-10-13  5:35 UTC (permalink / raw)
  To: GIT Mailing List; +Cc: Nicolas Pitre

This new option makes the resulting pack express the delta base
with more compact "offset" format.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 Documentation/git-repack.txt |    8 +++++++-
 git-repack.sh                |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 49f7e0a..5f5530d 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -9,7 +9,7 @@ objects into pack files.
 
 SYNOPSIS
 --------
-'git-repack' [-a] [-d] [-f] [-l] [-n] [-q] [--window=N] [--depth=N]
+'git-repack' [-a] [-b] [-d] [-f] [-l] [-n] [-q] [--window=N] [--depth=N]
 
 DESCRIPTION
 -----------
@@ -35,6 +35,12 @@ OPTIONS
 	about people fetching via dumb protocols from it.  Use
 	with '-d'.
 
+-b::
+	Pass the `--delta-base-offset` to `git pack-objects`;
+	see gitlink:git-pack-objects[1].  Do not use this option
+	if you want the repository to be accessible by older
+	versions of git.
+
 -d::
 	After packing, if the newly created packs make some
 	existing packs redundant, remove the redundant packs.
diff --git a/git-repack.sh b/git-repack.sh
index b525fc5..25dae5e 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -14,6 +14,7 @@ do
 	-n)	no_update_info=t ;;
 	-a)	all_into_one=t ;;
 	-d)	remove_redundant=t ;;
+	-b)	extra="$extra --delta-base-offset" ;;
 	-q)	quiet=-q ;;
 	-f)	no_reuse_delta=--no-reuse-delta ;;
 	-l)	local=--local ;;
-- 
1.4.3.rc2.g51ca

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13  5:35 ` [PATCH 2/2] git-repack: -b to pass --delta-base-offset Junio C Hamano
@ 2006-10-13 13:20   ` Nicolas Pitre
  2006-10-13 13:51     ` Jakub Narebski
  2006-10-13 21:22     ` Junio C Hamano
  2006-10-13 18:05   ` Horst H. von Brand
  1 sibling, 2 replies; 10+ messages in thread
From: Nicolas Pitre @ 2006-10-13 13:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing List

On Thu, 12 Oct 2006, Junio C Hamano wrote:

> This new option makes the resulting pack express the delta base
> with more compact "offset" format.

Actually I thought about making it the default whenever git-pack-objects 
supported it, and use a negative option with git-repack to disable it 
instead.

The fact is that there is little reason for not using delta base offsets 
in most cases and specifying -b all the time would become more of an 
annoyance.

What do you think?


Nicolas

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13 13:20   ` Nicolas Pitre
@ 2006-10-13 13:51     ` Jakub Narebski
  2006-10-13 21:22     ` Junio C Hamano
  1 sibling, 0 replies; 10+ messages in thread
From: Jakub Narebski @ 2006-10-13 13:51 UTC (permalink / raw)
  To: git

Nicolas Pitre wrote:

> On Thu, 12 Oct 2006, Junio C Hamano wrote:
> 
>> This new option makes the resulting pack express the delta base
>> with more compact "offset" format.
> 
> Actually I thought about making it the default whenever git-pack-objects 
> supported it, and use a negative option with git-repack to disable it 
> instead.
> 
> The fact is that there is little reason for not using delta base offsets 
> in most cases and specifying -b all the time would become more of an 
> annoyance.

Perhaps we should leave it to configuretion variable, instead?
And turn the new format on by default, like core.legacyHeaders
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13  5:35 ` [PATCH 2/2] git-repack: -b to pass --delta-base-offset Junio C Hamano
  2006-10-13 13:20   ` Nicolas Pitre
@ 2006-10-13 18:05   ` Horst H. von Brand
  2006-10-13 18:29     ` Nicolas Pitre
  1 sibling, 1 reply; 10+ messages in thread
From: Horst H. von Brand @ 2006-10-13 18:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing List, Nicolas Pitre

Junio C Hamano <junkio@cox.net> wrote:
> This new option makes the resulting pack express the delta base
> with more compact "offset" format.
> 
> Signed-off-by: Junio C Hamano <junkio@cox.net>

[...]

> @@ -35,6 +35,12 @@ OPTIONS
>  	about people fetching via dumb protocols from it.  Use
>  	with '-d'.
>  
> +-b::
> +	Pass the `--delta-base-offset` to `git pack-objects`;
> +	see gitlink:git-pack-objects[1].  Do not use this option
> +	if you want the repository to be accessible by older
> +	versions of git.
> +

Need to tell which version is the cutoff (say before 1.4.3 won't work).
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile               Fax:  +56 32 2797513

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13 18:05   ` Horst H. von Brand
@ 2006-10-13 18:29     ` Nicolas Pitre
  0 siblings, 0 replies; 10+ messages in thread
From: Nicolas Pitre @ 2006-10-13 18:29 UTC (permalink / raw)
  To: Horst H. von Brand; +Cc: Junio C Hamano, GIT Mailing List

On Fri, 13 Oct 2006, Horst H. von Brand wrote:

> Junio C Hamano <junkio@cox.net> wrote:
> > This new option makes the resulting pack express the delta base
> > with more compact "offset" format.
> > 
> > Signed-off-by: Junio C Hamano <junkio@cox.net>
> 
> [...]
> 
> > @@ -35,6 +35,12 @@ OPTIONS
> >  	about people fetching via dumb protocols from it.  Use
> >  	with '-d'.
> >  
> > +-b::
> > +	Pass the `--delta-base-offset` to `git pack-objects`;
> > +	see gitlink:git-pack-objects[1].  Do not use this option
> > +	if you want the repository to be accessible by older
> > +	versions of git.
> > +
> 
> Need to tell which version is the cutoff (say before 1.4.3 won't work).

Before and including 1.4.3 actually.  

Oh and the description should be augmented with "... if you want the 
repository to be accessible by older versions of git when _not_ using 
the native GIT protocol." as the native protocol is able to select 
between either format on the fly regardless of the on-disk pack format.


Nicolas

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13 13:20   ` Nicolas Pitre
  2006-10-13 13:51     ` Jakub Narebski
@ 2006-10-13 21:22     ` Junio C Hamano
  2006-10-13 21:29       ` Jakub Narebski
  2006-10-13 21:58       ` Nicolas Pitre
  1 sibling, 2 replies; 10+ messages in thread
From: Junio C Hamano @ 2006-10-13 21:22 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: git

Nicolas Pitre <nico@cam.org> writes:

> On Thu, 12 Oct 2006, Junio C Hamano wrote:
>
>> This new option makes the resulting pack express the delta base
>> with more compact "offset" format.
>
> Actually I thought about making it the default whenever git-pack-objects 
> supported it, and use a negative option with git-repack to disable it 
> instead.
>
> The fact is that there is little reason for not using delta base offsets 
> in most cases and specifying -b all the time would become more of an 
> annoyance.
>
> What do you think?

The only time it matters is if the packs in repository being
repacked needs to be readable by older git, which I think is
only when somebody with older git uses commit walkers to
download the pack into a remote repository to use.  Using or not
using delta-base-offset is tied to each repository, and in a
sense that is similar to "repository format version".

So how about

	[core]
        	repackUseDeltaBase = true

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13 21:22     ` Junio C Hamano
@ 2006-10-13 21:29       ` Jakub Narebski
  2006-10-13 21:58       ` Nicolas Pitre
  1 sibling, 0 replies; 10+ messages in thread
From: Jakub Narebski @ 2006-10-13 21:29 UTC (permalink / raw)
  To: git

Junio C Hamano wrote:

> So how about
> 
>         [core]
>                 repackUseDeltaBase = true

+1, but I'd rather first it default to false.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13 21:22     ` Junio C Hamano
  2006-10-13 21:29       ` Jakub Narebski
@ 2006-10-13 21:58       ` Nicolas Pitre
  2006-10-13 22:11         ` Junio C Hamano
  1 sibling, 1 reply; 10+ messages in thread
From: Nicolas Pitre @ 2006-10-13 21:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Fri, 13 Oct 2006, Junio C Hamano wrote:

> Nicolas Pitre <nico@cam.org> writes:
> 
> > On Thu, 12 Oct 2006, Junio C Hamano wrote:
> >
> >> This new option makes the resulting pack express the delta base
> >> with more compact "offset" format.
> >
> > Actually I thought about making it the default whenever git-pack-objects 
> > supported it, and use a negative option with git-repack to disable it 
> > instead.
> >
> > The fact is that there is little reason for not using delta base offsets 
> > in most cases and specifying -b all the time would become more of an 
> > annoyance.
> >
> > What do you think?
> 
> The only time it matters is if the packs in repository being
> repacked needs to be readable by older git, which I think is
> only when somebody with older git uses commit walkers to
> download the pack into a remote repository to use.  Using or not
> using delta-base-offset is tied to each repository, and in a
> sense that is similar to "repository format version".
> 
> So how about
> 
> 	[core]
>         	repackUseDeltaBase = true

I agree, although "repackUseDeltaBase" is a bit vague as both delta 
types do use a delta base.


Nicolas

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

* Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset
  2006-10-13 21:58       ` Nicolas Pitre
@ 2006-10-13 22:11         ` Junio C Hamano
  0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2006-10-13 22:11 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: git

Nicolas Pitre <nico@cam.org> writes:

>> So how about
>> 
>> 	[core]
>>         	repackUseDeltaBase = true
>
> I agree, although "repackUseDeltaBase" is a bit vague as both delta 
> types do use a delta base.

True; core.repackUseDeltaBaseOffset that is.

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

end of thread, other threads:[~2006-10-13 22:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-13  5:35 [PATCH 1/2] pack-objects: document --delta-base-offset option Junio C Hamano
2006-10-13  5:35 ` [PATCH 2/2] git-repack: -b to pass --delta-base-offset Junio C Hamano
2006-10-13 13:20   ` Nicolas Pitre
2006-10-13 13:51     ` Jakub Narebski
2006-10-13 21:22     ` Junio C Hamano
2006-10-13 21:29       ` Jakub Narebski
2006-10-13 21:58       ` Nicolas Pitre
2006-10-13 22:11         ` Junio C Hamano
2006-10-13 18:05   ` Horst H. von Brand
2006-10-13 18:29     ` Nicolas Pitre

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).