threads / patch / 5912

patch, 2 partspack-objects: document --delta-base-offset option

Subject: [PATCH 1/2] pack-objects: document --delta-base-offset option

## tl;dr

8 messages between Oct 13, 2006 and Oct 13, 2006. Diffs are folded; open one to read it.

replies: 7people: 3as markdown or json

Junio C Hamano· Oct 13, 2006, 05:35 UTC · lore
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(-)
Show changes to 2 files +13 −2

Documentation/git-pack-objects.txt, builtin-pack-objects.c

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
Junio C Hamano· Oct 13, 2006, 05:35 UTC · re: Junio C Hamano · lore

[PATCH 2/2] git-repack: -b to pass --delta-base-offset

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(-)
Show changes to 2 files +8 −1

Documentation/git-repack.txt, git-repack.sh

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
Nicolas Pitre· Oct 13, 2006, 13:20 UTC · re: Junio C Hamano · lore

Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset

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
Jakub Narebski· Oct 13, 2006, 13:51 UTC · re: Nicolas Pitre · lore

Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset

Nicolas Pitre wrote:
Show 12 quoted lines
> 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
Junio C Hamano· Oct 13, 2006, 21:22 UTC · re: Nicolas Pitre · lore

Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset

Nicolas Pitre <nico@cam.org> writes:
Show 14 quoted lines
> 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
Jakub Narebski· Oct 13, 2006, 21:29 UTC · re: Junio C Hamano · lore

Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset

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
Nicolas Pitre· Oct 13, 2006, 21:58 UTC · re: Junio C Hamano · lore

Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset

On Fri, 13 Oct 2006, Junio C Hamano wrote:
Show 28 quoted lines
> 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
Junio C Hamano· Oct 13, 2006, 22:11 UTC · re: Nicolas Pitre · lore

Re: [PATCH 2/2] git-repack: -b to pass --delta-base-offset

Nicolas Pitre <nico@cam.org> writes:
Show 7 quoted lines
>> 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.

← back to recent threads