Skip to content

Commit fcae86a

Browse files
committed
Merge commit 'c5f2e07681' into HEAD
* commit 'c5f2e07681': (82 commits) ### setup: fix reinit of repos with incompatible GIT_DEFAULT_HASH setup: fix reinit of repos with incompatible GIT_DEFAULT_REF_FORMAT t0001: remove duplicate test apply: detect overflow when parsing hunk header libgit: add higher-level libgit crate libgit-sys: also export some config_set functions libgit-sys: introduce Rust wrapper for libgit.a common-main: split init and exit code into new files Makefile: skip reftable library for Coccinelle reftable: decouple from Git codebase by pulling in "compat/posix.h" git-compat-util.h: split out POSIX-emulating bits compat/msvc: split out POSIX-related bits compat/mingw: split out POSIX-related bits compat: consistently resolve headers via project root reftable/basics: stop using `UNUSED` annotation reftable/basics: stop using `SWAP()` macro reftable/stack: stop using `sleep_millisec()` reftable/system: introduce `reftable_rand()` reftable/reader: stop using `ARRAY_SIZE()` macro ...
2 parents 700d770 + c5f2e07 commit fcae86a

File tree

186 files changed

+6533
-1622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+6533
-1622
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/git-apply
2020
/git-archimport
2121
/git-archive
22+
/git-backfill
2223
/git-bisect
2324
/git-blame
2425
/git-branch
@@ -250,3 +251,5 @@ Release/
250251
/git.VC.db
251252
*.dSYM
252253
/contrib/buildsystems/out
254+
/contrib/libgit-rs/target
255+
/contrib/libgit-sys/target

Documentation/config/help.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ help.autoCorrect::
1111
If git detects typos and can identify exactly one valid command similar
1212
to the error, git will try to suggest the correct command or even
1313
run the suggestion automatically. Possible config values are:
14-
- 0 (default): show the suggested command.
15-
- positive number: run the suggested command after specified
14+
- 0: show the suggested command (default).
15+
- 1, "true", "on", "yes", "immediate": run the suggested command
16+
immediately.
17+
- positive number > 1: run the suggested command after specified
1618
deciseconds (0.1 sec).
17-
- "immediate": run the suggested command immediately.
19+
- "false", "off", "no", "never": don't run or show any suggested command.
1820
- "prompt": show the suggestion and prompt for confirmation to run
1921
the command.
20-
- "never": don't run or show any suggested command.
2122

2223
help.htmlPath::
2324
Specify the path where the HTML documentation resides. File system paths

Documentation/config/promisor.adoc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
promisor.quiet::
22
If set to "true" assume `--quiet` when fetching additional
33
objects for a partial clone.
4+
5+
promisor.advertise::
6+
If set to "true", a server will use the "promisor-remote"
7+
capability, see linkgit:gitprotocol-v2[5], to advertise the
8+
promisor remotes it is using, if it uses some. Default is
9+
"false", which means the "promisor-remote" capability is not
10+
advertised.
11+
12+
promisor.acceptFromServer::
13+
If set to "all", a client will accept all the promisor remotes
14+
a server might advertise using the "promisor-remote"
15+
capability. If set to "knownName" the client will accept
16+
promisor remotes which are already configured on the client
17+
and have the same name as those advertised by the client. This
18+
is not very secure, but could be used in a corporate setup
19+
where servers and clients are trusted to not switch name and
20+
URLs. If set to "knownUrl", the client will accept promisor
21+
remotes which have both the same name and the same URL
22+
configured on the client as the name and URL advertised by the
23+
server. This is more secure than "all" or "knownUrl", so it
24+
should be used if possible instead of those options. Default
25+
is "none", which means no promisor remote advertised by a
26+
server will be accepted. By accepting a promisor remote, the
27+
client agrees that the server might omit objects that are
28+
lazily fetchable from this promisor remote from its responses
29+
to "fetch" and "clone" requests from the client. See
30+
linkgit:gitprotocol-v2[5].

Documentation/config/transfer.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,10 @@ transfer.bundleURI::
125125
transfer.advertiseObjectInfo::
126126
When `true`, the `object-info` capability is advertised by
127127
servers. Defaults to false.
128+
129+
transfer.advertiseOSVersion::
130+
When set to `true` on the server, the server will advertise its
131+
`os-version` capability to the client. On the client side, if set
132+
to `true`, it will advertise its `os-version` capability to the
133+
server only if the server also advertises its `os-version` capability.
134+
Defaults to true.

Documentation/git-backfill.adoc

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
git-backfill(1)
2+
===============
3+
4+
NAME
5+
----
6+
git-backfill - Download missing objects in a partial clone
7+
8+
9+
SYNOPSIS
10+
--------
11+
[verse]
12+
'git backfill' [--batch-size=<n>] [--[no-]sparse]
13+
14+
DESCRIPTION
15+
-----------
16+
17+
Blobless partial clones are created using `git clone --filter=blob:none`
18+
and then configure the local repository such that the Git client avoids
19+
downloading blob objects unless they are required for a local operation.
20+
This initially means that the clone and later fetches download reachable
21+
commits and trees but no blobs. Later operations that change the `HEAD`
22+
pointer, such as `git checkout` or `git merge`, may need to download
23+
missing blobs in order to complete their operation.
24+
25+
In the worst cases, commands that compute blob diffs, such as `git blame`,
26+
become very slow as they download the missing blobs in single-blob
27+
requests to satisfy the missing object as the Git command needs it. This
28+
leads to multiple download requests and no ability for the Git server to
29+
provide delta compression across those objects.
30+
31+
The `git backfill` command provides a way for the user to request that
32+
Git downloads the missing blobs (with optional filters) such that the
33+
missing blobs representing historical versions of files can be downloaded
34+
in batches. The `backfill` command attempts to optimize the request by
35+
grouping blobs that appear at the same path, hopefully leading to good
36+
delta compression in the packfile sent by the server.
37+
38+
In this way, `git backfill` provides a mechanism to break a large clone
39+
into smaller chunks. Starting with a blobless partial clone with `git
40+
clone --filter=blob:none` and then running `git backfill` in the local
41+
repository provides a way to download all reachable objects in several
42+
smaller network calls than downloading the entire repository at clone
43+
time.
44+
45+
By default, `git backfill` downloads all blobs reachable from the `HEAD`
46+
commit. This set can be restricted or expanded using various options.
47+
48+
OPTIONS
49+
-------
50+
51+
--min-batch-size=<n>::
52+
Specify a minimum size for a batch of missing objects to request
53+
from the server. This size may be exceeded by the last set of
54+
blobs seen at a given path. The default minimum batch size is
55+
50,000.
56+
57+
--[no-]sparse::
58+
Only download objects if they appear at a path that matches the
59+
current sparse-checkout. If the sparse-checkout feature is enabled,
60+
then `--sparse` is assumed and can be disabled with `--no-sparse`.
61+
62+
SEE ALSO
63+
--------
64+
linkgit:git-clone[1].
65+
66+
GIT
67+
---
68+
Part of the linkgit:git[1] suite

Documentation/git-cat-file.adoc

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ info <object>::
149149
Print object info for object reference `<object>`. This corresponds to the
150150
output of `--batch-check`.
151151

152+
remote-object-info <remote> <object>...::
153+
Print object info for object references `<object>` at specified
154+
`<remote>` without downloading objects from the remote.
155+
Raise an error when the `object-info` capability is not supported by the remote.
156+
Raise an error when no object references are provided.
157+
This command may be combined with `--buffer`.
158+
152159
flush::
153160
Used with `--buffer` to execute all preceding commands that were issued
154161
since the beginning or since the last flush was issued. When `--buffer`
@@ -290,21 +297,23 @@ newline. The available atoms are:
290297
The full hex representation of the object name.
291298

292299
`objecttype`::
293-
The type of the object (the same as `cat-file -t` reports).
300+
The type of the object (the same as `cat-file -t` reports). See
301+
`CAVEATS` below. Not supported by `remote-object-info`.
294302

295303
`objectsize`::
296304
The size, in bytes, of the object (the same as `cat-file -s`
297305
reports).
298306

299307
`objectsize:disk`::
300308
The size, in bytes, that the object takes up on disk. See the
301-
note about on-disk sizes in the `CAVEATS` section below.
309+
note about on-disk sizes in the `CAVEATS` section below. Not
310+
supported by `remote-object-info`.
302311

303312
`deltabase`::
304313
If the object is stored as a delta on-disk, this expands to the
305314
full hex representation of the delta base object name.
306315
Otherwise, expands to the null OID (all zeroes). See `CAVEATS`
307-
below.
316+
below. Not supported by `remote-object-info`.
308317

309318
`rest`::
310319
If this atom is used in the output string, input lines are split
@@ -314,7 +323,10 @@ newline. The available atoms are:
314323
line) are output in place of the `%(rest)` atom.
315324

316325
If no format is specified, the default format is `%(objectname)
317-
%(objecttype) %(objectsize)`.
326+
%(objecttype) %(objectsize)`, except for `remote-object-info` commands which use
327+
`%(objectname) %(objectsize)` for now because "%(objecttype)" is not supported yet.
328+
WARNING: When "%(objecttype)" is supported, the default format WILL be unified, so
329+
DO NOT RELY on the current default format to stay the same!!!
318330

319331
If `--batch` is specified, or if `--batch-command` is used with the `contents`
320332
command, the object information is followed by the object contents (consisting
@@ -396,6 +408,10 @@ scripting purposes.
396408
CAVEATS
397409
-------
398410
411+
Note that since %(objecttype), %(objectsize:disk) and %(deltabase) are
412+
currently not supported by the `remote-object-info` command, we will raise
413+
an error and exit when they appear in the format string.
414+
399415
Note that the sizes of objects on disk are reported accurately, but care
400416
should be taken in drawing conclusions about which refs or objects are
401417
responsible for disk usage. The size of a packed non-delta object may be

Documentation/git-gc.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ be performed as well.
6969
the `--max-cruft-size` option of linkgit:git-repack[1] for
7070
more.
7171

72+
--expire-to=<dir>::
73+
When packing unreachable objects into a cruft pack, write a cruft
74+
pack containing pruned objects (if any) to the directory `<dir>`.
75+
This option only has an effect when used together with `--cruft`.
76+
See the `--expire-to` option of linkgit:git-repack[1] for
77+
more information.
78+
7279
--prune=<date>::
7380
Prune loose objects older than date (default is 2 weeks ago,
7481
overridable by the config variable `gc.pruneExpire`).

Documentation/git-pack-objects.adoc

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ SYNOPSIS
1515
[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
1616
[--cruft] [--cruft-expiration=<time>]
1717
[--stdout [--filter=<filter-spec>] | <base-name>]
18-
[--shallow] [--keep-true-parents] [--[no-]sparse] < <object-list>
18+
[--shallow] [--keep-true-parents] [--[no-]sparse]
19+
[--name-hash-version=<n>] < <object-list>
1920

2021

2122
DESCRIPTION
@@ -345,6 +346,35 @@ raise an error.
345346
Restrict delta matches based on "islands". See DELTA ISLANDS
346347
below.
347348
349+
--name-hash-version=<n>::
350+
While performing delta compression, Git groups objects that may be
351+
similar based on heuristics using the path to that object. While
352+
grouping objects by an exact path match is good for paths with
353+
many versions, there are benefits for finding delta pairs across
354+
different full paths. Git collects objects by type and then by a
355+
"name hash" of the path and then by size, hoping to group objects
356+
that will compress well together.
357+
+
358+
The default name hash version is `1`, which prioritizes hash locality by
359+
considering the final bytes of the path as providing the maximum magnitude
360+
to the hash function. This version excels at distinguishing short paths
361+
and finding renames across directories. However, the hash function depends
362+
primarily on the final 16 bytes of the path. If there are many paths in
363+
the repo that have the same final 16 bytes and differ only by parent
364+
directory, then this name-hash may lead to too many collisions and cause
365+
poor results. At the moment, this version is required when writing
366+
reachability bitmap files with `--write-bitmap-index`.
367+
+
368+
The name hash version `2` has similar locality features as version `1`,
369+
except it considers each path component separately and overlays the hashes
370+
with a shift. This still prioritizes the final bytes of the path, but also
371+
"salts" the lower bits of the hash using the parent directory names. This
372+
method allows for some of the locality benefits of version `1` while
373+
breaking most of the collisions from a similarly-named file appearing in
374+
many different directories. At the moment, this version is not allowed
375+
when writing reachability bitmap files with `--write-bitmap-index` and it
376+
will be automatically changed to version `1`.
377+
348378
349379
DELTA ISLANDS
350380
-------------

Documentation/git-repack.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ git-repack - Pack unpacked objects in a repository
99
SYNOPSIS
1010
--------
1111
[verse]
12-
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>] [--write-midx]
12+
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m]
13+
[--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
14+
[--write-midx] [--name-hash-version=<n>]
1315

1416
DESCRIPTION
1517
-----------
@@ -249,6 +251,11 @@ linkgit:git-multi-pack-index[1]).
249251
Write a multi-pack index (see linkgit:git-multi-pack-index[1])
250252
containing the non-redundant packs.
251253

254+
--name-hash-version=<n>::
255+
Provide this argument to the underlying `git pack-objects` process.
256+
See linkgit:git-pack-objects[1] for full details.
257+
258+
252259
CONFIGURATION
253260
-------------
254261

Documentation/gitprotocol-v2.adoc

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,23 @@ printable ASCII characters except space (i.e., the byte range 32 < x <
190190
and debugging purposes, and MUST NOT be used to programmatically assume
191191
the presence or absence of particular features.
192192
193+
os-version
194+
~~~~~~~~~~
195+
196+
In the same way as the `agent` capability above, the server can
197+
advertise the `os-version` capability to notify the client the
198+
kind of operating system it is running on. The client may optionally
199+
send its own `os-version` capability, to notify the server the kind
200+
of operating system it is also running on in its request to the server
201+
(but it MUST NOT do so if the server did not advertise the os-version
202+
capability). The value of this capability may consist of ASCII printable
203+
characters(from 33 to 126 inclusive) and are typically made from the
204+
result of `uname -s`(OS name e.g Linux). The os-version capability can
205+
be disabled entirely by setting the `transfer.advertiseOSVersion` config
206+
option to `false`. The `os-version` strings are purely informative for
207+
statistics and debugging purposes, and MUST NOT be used to
208+
programmatically assume the presence or absence of particular features.
209+
193210
ls-refs
194211
~~~~~~~
195212
@@ -781,6 +798,60 @@ retrieving the header from a bundle at the indicated URI, and thus
781798
save themselves and the server(s) the request(s) needed to inspect the
782799
headers of that bundle or bundles.
783800
801+
promisor-remote=<pr-infos>
802+
~~~~~~~~~~~~~~~~~~~~~~~~~~
803+
804+
The server may advertise some promisor remotes it is using or knows
805+
about to a client which may want to use them as its promisor remotes,
806+
instead of this repository. In this case <pr-infos> should be of the
807+
form:
808+
809+
pr-infos = pr-info | pr-infos ";" pr-info
810+
811+
pr-info = "name=" pr-name | "name=" pr-name "," "url=" pr-url
812+
813+
where `pr-name` is the urlencoded name of a promisor remote, and
814+
`pr-url` the urlencoded URL of that promisor remote.
815+
816+
In this case, if the client decides to use one or more promisor
817+
remotes the server advertised, it can reply with
818+
"promisor-remote=<pr-names>" where <pr-names> should be of the form:
819+
820+
pr-names = pr-name | pr-names ";" pr-name
821+
822+
where `pr-name` is the urlencoded name of a promisor remote the server
823+
advertised and the client accepts.
824+
825+
Note that, everywhere in this document, `pr-name` MUST be a valid
826+
remote name, and the ';' and ',' characters MUST be encoded if they
827+
appear in `pr-name` or `pr-url`.
828+
829+
If the server doesn't know any promisor remote that could be good for
830+
a client to use, or prefers a client not to use any promisor remote it
831+
uses or knows about, it shouldn't advertise the "promisor-remote"
832+
capability at all.
833+
834+
In this case, or if the client doesn't want to use any promisor remote
835+
the server advertised, the client shouldn't advertise the
836+
"promisor-remote" capability at all in its reply.
837+
838+
The "promisor.advertise" and "promisor.acceptFromServer" configuration
839+
options can be used on the server and client side respectively to
840+
control what they advertise or accept respectively. See the
841+
documentation of these configuration options for more information.
842+
843+
Note that in the future it would be nice if the "promisor-remote"
844+
protocol capability could be used by the server, when responding to
845+
`git fetch` or `git clone`, to advertise better-connected remotes that
846+
the client can use as promisor remotes, instead of this repository, so
847+
that the client can lazily fetch objects from these other
848+
better-connected remotes. This would require the server to omit in its
849+
response the objects available on the better-connected remotes that
850+
the client has accepted. This hasn't been implemented yet though. So
851+
for now this "promisor-remote" capability is useful only when the
852+
server advertises some promisor remotes it already uses to borrow
853+
objects from.
854+
784855
GIT
785856
---
786857
Part of the linkgit:git[1] suite

0 commit comments

Comments
 (0)