Skip to content

Commit 2feff74

Browse files
committed
Merge branch 'ds/path-walk-2' into jch
"git pack-objects" learns to find delta bases from blobs at the same path, using the --path-walk API. * ds/path-walk-2: pack-objects: allow --shallow and --path-walk path-walk: add new 'edge_aggressive' option pack-objects: thread the path-based compression pack-objects: refactor path-walk delta phase scalar: enable path-walk during push via config pack-objects: enable --path-walk via config repack: add --path-walk option t5538: add tests to confirm deltas in shallow pushes pack-objects: introduce GIT_TEST_PACK_PATH_WALK p5313: add performance tests for --path-walk pack-objects: update usage to match docs pack-objects: add --path-walk option pack-objects: extract should_attempt_deltas()
2 parents 14f697b + c178b02 commit 2feff74

27 files changed

+620
-66
lines changed

Documentation/config/feature.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ walking fewer objects.
2020
+
2121
* `pack.allowPackReuse=multi` may improve the time it takes to create a pack by
2222
reusing objects from multiple packs instead of just one.
23+
+
24+
* `pack.usePathWalk` may speed up packfile creation and make the packfiles be
25+
significantly smaller in the presence of certain filename collisions with Git's
26+
default name-hash.
2327
2428
feature.manyFiles::
2529
Enable config options that optimize for repos with many files in the

Documentation/config/pack.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ pack.useSparse::
155155
commits contain certain types of direct renames. Default is
156156
`true`.
157157

158+
pack.usePathWalk::
159+
Enable the `--path-walk` option by default for `git pack-objects`
160+
processes. See linkgit:git-pack-objects[1] for full details.
161+
158162
pack.preferBitmapTips::
159163
When selecting which commits will receive bitmaps, prefer a
160164
commit at the tip of any reference that is a suffix of any value

Documentation/git-pack-objects.adoc

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ SYNOPSIS
1010
--------
1111
[verse]
1212
'git pack-objects' [-q | --progress | --all-progress] [--all-progress-implied]
13-
[--no-reuse-delta] [--delta-base-offset] [--non-empty]
14-
[--local] [--incremental] [--window=<n>] [--depth=<n>]
15-
[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
16-
[--cruft] [--cruft-expiration=<time>]
17-
[--stdout [--filter=<filter-spec>] | <base-name>]
18-
[--shallow] [--keep-true-parents] [--[no-]sparse]
19-
[--name-hash-version=<n>] < <object-list>
13+
[--no-reuse-delta] [--delta-base-offset] [--non-empty]
14+
[--local] [--incremental] [--window=<n>] [--depth=<n>]
15+
[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
16+
[--cruft] [--cruft-expiration=<time>]
17+
[--stdout [--filter=<filter-spec>] | <base-name>]
18+
[--shallow] [--keep-true-parents] [--[no-]sparse]
19+
[--name-hash-version=<n>] [--path-walk] < <object-list>
2020

2121

2222
DESCRIPTION
@@ -375,6 +375,17 @@ many different directories. At the moment, this version is not allowed
375375
when writing reachability bitmap files with `--write-bitmap-index` and it
376376
will be automatically changed to version `1`.
377377
378+
--path-walk::
379+
Perform compression by first organizing objects by path, then a
380+
second pass that compresses across paths as normal. This has the
381+
potential to improve delta compression especially in the presence
382+
of filenames that cause collisions in Git's default name-hash
383+
algorithm.
384+
+
385+
Incompatible with `--delta-islands`, `--shallow`, or `--filter`. The
386+
`--use-bitmap-index` option will be ignored in the presence of
387+
`--path-walk.`
388+
378389
379390
DELTA ISLANDS
380391
-------------

Documentation/git-repack.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SYNOPSIS
1111
[verse]
1212
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m]
1313
[--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
14-
[--write-midx] [--name-hash-version=<n>]
14+
[--write-midx] [--name-hash-version=<n>] [--path-walk]
1515

1616
DESCRIPTION
1717
-----------
@@ -258,6 +258,9 @@ linkgit:git-multi-pack-index[1]).
258258
Provide this argument to the underlying `git pack-objects` process.
259259
See linkgit:git-pack-objects[1] for full details.
260260

261+
--path-walk::
262+
Pass the `--path-walk` option to the underlying `git pack-objects`
263+
process. See linkgit:git-pack-objects[1] for full details.
261264

262265
CONFIGURATION
263266
-------------

Documentation/technical/api-path-walk.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ better off using the revision walk API instead.
5656
the revision walk so that the walk emits commits marked with the
5757
`UNINTERESTING` flag.
5858

59+
`edge_aggressive`::
60+
For performance reasons, usually only the boundary commits are
61+
explored to find UNINTERESTING objects. However, in the case of
62+
shallow clones it can be helpful to mark all trees and blobs
63+
reachable from UNINTERESTING tip commits as UNINTERESTING. This
64+
matches the behavior of `--objects-edge-aggressive` in the
65+
revision API.
66+
5967
`pl`::
6068
This pattern list pointer allows focusing the path-walk search to
6169
a set of patterns, only emitting paths that match the given
@@ -69,4 +77,5 @@ Examples
6977

7078
See example usages in:
7179
`t/helper/test-path-walk.c`,
80+
`builtin/pack-objects.c`,
7281
`builtin/backfill.c`

0 commit comments

Comments
 (0)