Skip to contentSkip to conversation

pack-objects: document --delta-base-offset option

PATCH In review Junio C Hamano 4 participants 10 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

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

---
 Documentation/git-pack-objects.txt |   13 ++++++++++++-
 builtin-pack-objects.c             |    2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)
Documentation/git-pack-objects.txt +12 -1
index d4661dd..5788709 100644
@@ -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
 ------
builtin-pack-objects.c +1 -1
index ee5f031..41e1e74 100644
@@ -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];
Signature · 1 line
1.4.3.rc2.g51ca
#1 lore raw

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.

---
 Documentation/git-repack.txt |    8 +++++++-
 git-repack.sh                |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)
Documentation/git-repack.txt +7 -1
index 49f7e0a..5f5530d 100644
@@ -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.
git-repack.sh +1 -0
index b525fc5..25dae5e 100755
@@ -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 ;;
Signature · 1 line
1.4.3.rc2.g51ca
#2 lore raw

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

Quoted 4 lines · Junio C Hamano

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

[...]

Documentation/git-repack.txt OPTIONS · line 43

Quoted 10 lines
Documentation/git-repack.txt +6 -0
@@ -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).

Signature · 4 lines
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
#3 lore raw

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

Quoted 12 lines · Horst H. von Brand
Quoted 4 lines · Junio C Hamano

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

[...]

Quoted 4 lines
Documentation/git-repack.txt +0 -0
@@ -35,6 +35,12 @@ OPTIONS
 	about people fetching via dumb protocols from it.  Use
 	with '-d'.
 
Quoted 8 lines

Documentation/git-repack.txt OPTIONS · line 43

Quoted 6 lines
Documentation/git-repack.txt +6 -0
+-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

#4 lore raw

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

In reply to Junio C Hamano
Quoted 2 lines · Junio C Hamano

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

#5 lore raw

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

Quoted 9 lines · Nicolas Pitre
Quoted 2 lines · Junio C Hamano

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.

Quoted 5 lines

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
#6 lore raw

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

Quoted 24 lines · Junio C Hamano
Quoted 9 lines · Nicolas Pitre
Quoted 2 lines · Junio C Hamano

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.

Quoted 5 lines

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

Quoted 4 lines

So how about

	[core]
        	repackUseDeltaBase = true

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

Nicolas

#7 lore raw

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

Quoted 7 lines · Nicolas Pitre
Quoted 4 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.

#8 lore raw

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

In reply to Junio C Hamano
Quoted 4 lines · Junio C Hamano

So how about

        [core]
                repackUseDeltaBase = true

+1, but I'd rather first it default to false.

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
#9 lore raw

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

In reply to Nicolas Pitre
Quoted 5 lines · Nicolas Pitre
Quoted 2 lines · Junio C Hamano

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

Quoted 7 lines

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

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git