Skip to content

Commit

Permalink
Merge commit 'c5f2e07681' into HEAD
Browse files Browse the repository at this point in the history
* 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
  ...
  • Loading branch information
gitster committed Jan 31, 2025
2 parents 700d770 + c5f2e07 commit fcae86a
Show file tree
Hide file tree
Showing 186 changed files with 6,533 additions and 1,622 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/git-apply
/git-archimport
/git-archive
/git-backfill
/git-bisect
/git-blame
/git-branch
Expand Down Expand Up @@ -250,3 +251,5 @@ Release/
/git.VC.db
*.dSYM
/contrib/buildsystems/out
/contrib/libgit-rs/target
/contrib/libgit-sys/target
9 changes: 5 additions & 4 deletions Documentation/config/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ help.autoCorrect::
If git detects typos and can identify exactly one valid command similar
to the error, git will try to suggest the correct command or even
run the suggestion automatically. Possible config values are:
- 0 (default): show the suggested command.
- positive number: run the suggested command after specified
- 0: show the suggested command (default).
- 1, "true", "on", "yes", "immediate": run the suggested command
immediately.
- positive number > 1: run the suggested command after specified
deciseconds (0.1 sec).
- "immediate": run the suggested command immediately.
- "false", "off", "no", "never": don't run or show any suggested command.
- "prompt": show the suggestion and prompt for confirmation to run
the command.
- "never": don't run or show any suggested command.

help.htmlPath::
Specify the path where the HTML documentation resides. File system paths
Expand Down
27 changes: 27 additions & 0 deletions Documentation/config/promisor.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
promisor.quiet::
If set to "true" assume `--quiet` when fetching additional
objects for a partial clone.

promisor.advertise::
If set to "true", a server will use the "promisor-remote"
capability, see linkgit:gitprotocol-v2[5], to advertise the
promisor remotes it is using, if it uses some. Default is
"false", which means the "promisor-remote" capability is not
advertised.

promisor.acceptFromServer::
If set to "all", a client will accept all the promisor remotes
a server might advertise using the "promisor-remote"
capability. If set to "knownName" the client will accept
promisor remotes which are already configured on the client
and have the same name as those advertised by the client. This
is not very secure, but could be used in a corporate setup
where servers and clients are trusted to not switch name and
URLs. If set to "knownUrl", the client will accept promisor
remotes which have both the same name and the same URL
configured on the client as the name and URL advertised by the
server. This is more secure than "all" or "knownUrl", so it
should be used if possible instead of those options. Default
is "none", which means no promisor remote advertised by a
server will be accepted. By accepting a promisor remote, the
client agrees that the server might omit objects that are
lazily fetchable from this promisor remote from its responses
to "fetch" and "clone" requests from the client. See
linkgit:gitprotocol-v2[5].
7 changes: 7 additions & 0 deletions Documentation/config/transfer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,10 @@ transfer.bundleURI::
transfer.advertiseObjectInfo::
When `true`, the `object-info` capability is advertised by
servers. Defaults to false.

transfer.advertiseOSVersion::
When set to `true` on the server, the server will advertise its
`os-version` capability to the client. On the client side, if set
to `true`, it will advertise its `os-version` capability to the
server only if the server also advertises its `os-version` capability.
Defaults to true.
68 changes: 68 additions & 0 deletions Documentation/git-backfill.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
git-backfill(1)
===============

NAME
----
git-backfill - Download missing objects in a partial clone


SYNOPSIS
--------
[verse]
'git backfill' [--batch-size=<n>] [--[no-]sparse]

DESCRIPTION
-----------

Blobless partial clones are created using `git clone --filter=blob:none`
and then configure the local repository such that the Git client avoids
downloading blob objects unless they are required for a local operation.
This initially means that the clone and later fetches download reachable
commits and trees but no blobs. Later operations that change the `HEAD`
pointer, such as `git checkout` or `git merge`, may need to download
missing blobs in order to complete their operation.

In the worst cases, commands that compute blob diffs, such as `git blame`,
become very slow as they download the missing blobs in single-blob
requests to satisfy the missing object as the Git command needs it. This
leads to multiple download requests and no ability for the Git server to
provide delta compression across those objects.

The `git backfill` command provides a way for the user to request that
Git downloads the missing blobs (with optional filters) such that the
missing blobs representing historical versions of files can be downloaded
in batches. The `backfill` command attempts to optimize the request by
grouping blobs that appear at the same path, hopefully leading to good
delta compression in the packfile sent by the server.

In this way, `git backfill` provides a mechanism to break a large clone
into smaller chunks. Starting with a blobless partial clone with `git
clone --filter=blob:none` and then running `git backfill` in the local
repository provides a way to download all reachable objects in several
smaller network calls than downloading the entire repository at clone
time.

By default, `git backfill` downloads all blobs reachable from the `HEAD`
commit. This set can be restricted or expanded using various options.

OPTIONS
-------

--min-batch-size=<n>::
Specify a minimum size for a batch of missing objects to request
from the server. This size may be exceeded by the last set of
blobs seen at a given path. The default minimum batch size is
50,000.

--[no-]sparse::
Only download objects if they appear at a path that matches the
current sparse-checkout. If the sparse-checkout feature is enabled,
then `--sparse` is assumed and can be disabled with `--no-sparse`.

SEE ALSO
--------
linkgit:git-clone[1].

GIT
---
Part of the linkgit:git[1] suite
24 changes: 20 additions & 4 deletions Documentation/git-cat-file.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ info <object>::
Print object info for object reference `<object>`. This corresponds to the
output of `--batch-check`.

remote-object-info <remote> <object>...::
Print object info for object references `<object>` at specified
`<remote>` without downloading objects from the remote.
Raise an error when the `object-info` capability is not supported by the remote.
Raise an error when no object references are provided.
This command may be combined with `--buffer`.

flush::
Used with `--buffer` to execute all preceding commands that were issued
since the beginning or since the last flush was issued. When `--buffer`
Expand Down Expand Up @@ -290,21 +297,23 @@ newline. The available atoms are:
The full hex representation of the object name.

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

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

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

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

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

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

If `--batch` is specified, or if `--batch-command` is used with the `contents`
command, the object information is followed by the object contents (consisting
Expand Down Expand Up @@ -396,6 +408,10 @@ scripting purposes.
CAVEATS
-------
Note that since %(objecttype), %(objectsize:disk) and %(deltabase) are
currently not supported by the `remote-object-info` command, we will raise
an error and exit when they appear in the format string.
Note that the sizes of objects on disk are reported accurately, but care
should be taken in drawing conclusions about which refs or objects are
responsible for disk usage. The size of a packed non-delta object may be
Expand Down
7 changes: 7 additions & 0 deletions Documentation/git-gc.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ be performed as well.
the `--max-cruft-size` option of linkgit:git-repack[1] for
more.

--expire-to=<dir>::
When packing unreachable objects into a cruft pack, write a cruft
pack containing pruned objects (if any) to the directory `<dir>`.
This option only has an effect when used together with `--cruft`.
See the `--expire-to` option of linkgit:git-repack[1] for
more information.

--prune=<date>::
Prune loose objects older than date (default is 2 weeks ago,
overridable by the config variable `gc.pruneExpire`).
Expand Down
32 changes: 31 additions & 1 deletion Documentation/git-pack-objects.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ SYNOPSIS
[--revs [--unpacked | --all]] [--keep-pack=<pack-name>]
[--cruft] [--cruft-expiration=<time>]
[--stdout [--filter=<filter-spec>] | <base-name>]
[--shallow] [--keep-true-parents] [--[no-]sparse] < <object-list>
[--shallow] [--keep-true-parents] [--[no-]sparse]
[--name-hash-version=<n>] < <object-list>


DESCRIPTION
Expand Down Expand Up @@ -345,6 +346,35 @@ raise an error.
Restrict delta matches based on "islands". See DELTA ISLANDS
below.
--name-hash-version=<n>::
While performing delta compression, Git groups objects that may be
similar based on heuristics using the path to that object. While
grouping objects by an exact path match is good for paths with
many versions, there are benefits for finding delta pairs across
different full paths. Git collects objects by type and then by a
"name hash" of the path and then by size, hoping to group objects
that will compress well together.
+
The default name hash version is `1`, which prioritizes hash locality by
considering the final bytes of the path as providing the maximum magnitude
to the hash function. This version excels at distinguishing short paths
and finding renames across directories. However, the hash function depends
primarily on the final 16 bytes of the path. If there are many paths in
the repo that have the same final 16 bytes and differ only by parent
directory, then this name-hash may lead to too many collisions and cause
poor results. At the moment, this version is required when writing
reachability bitmap files with `--write-bitmap-index`.
+
The name hash version `2` has similar locality features as version `1`,
except it considers each path component separately and overlays the hashes
with a shift. This still prioritizes the final bytes of the path, but also
"salts" the lower bits of the hash using the parent directory names. This
method allows for some of the locality benefits of version `1` while
breaking most of the collisions from a similarly-named file appearing in
many different directories. At the moment, this version is not allowed
when writing reachability bitmap files with `--write-bitmap-index` and it
will be automatically changed to version `1`.
DELTA ISLANDS
-------------
Expand Down
9 changes: 8 additions & 1 deletion Documentation/git-repack.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ git-repack - Pack unpacked objects in a repository
SYNOPSIS
--------
[verse]
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>] [--write-midx]
'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m]
[--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
[--write-midx] [--name-hash-version=<n>]

DESCRIPTION
-----------
Expand Down Expand Up @@ -249,6 +251,11 @@ linkgit:git-multi-pack-index[1]).
Write a multi-pack index (see linkgit:git-multi-pack-index[1])
containing the non-redundant packs.

--name-hash-version=<n>::
Provide this argument to the underlying `git pack-objects` process.
See linkgit:git-pack-objects[1] for full details.


CONFIGURATION
-------------

Expand Down
71 changes: 71 additions & 0 deletions Documentation/gitprotocol-v2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,23 @@ printable ASCII characters except space (i.e., the byte range 32 < x <
and debugging purposes, and MUST NOT be used to programmatically assume
the presence or absence of particular features.
os-version
~~~~~~~~~~
In the same way as the `agent` capability above, the server can
advertise the `os-version` capability to notify the client the
kind of operating system it is running on. The client may optionally
send its own `os-version` capability, to notify the server the kind
of operating system it is also running on in its request to the server
(but it MUST NOT do so if the server did not advertise the os-version
capability). The value of this capability may consist of ASCII printable
characters(from 33 to 126 inclusive) and are typically made from the
result of `uname -s`(OS name e.g Linux). The os-version capability can
be disabled entirely by setting the `transfer.advertiseOSVersion` config
option to `false`. The `os-version` strings are purely informative for
statistics and debugging purposes, and MUST NOT be used to
programmatically assume the presence or absence of particular features.
ls-refs
~~~~~~~
Expand Down Expand Up @@ -781,6 +798,60 @@ retrieving the header from a bundle at the indicated URI, and thus
save themselves and the server(s) the request(s) needed to inspect the
headers of that bundle or bundles.
promisor-remote=<pr-infos>
~~~~~~~~~~~~~~~~~~~~~~~~~~
The server may advertise some promisor remotes it is using or knows
about to a client which may want to use them as its promisor remotes,
instead of this repository. In this case <pr-infos> should be of the
form:
pr-infos = pr-info | pr-infos ";" pr-info
pr-info = "name=" pr-name | "name=" pr-name "," "url=" pr-url
where `pr-name` is the urlencoded name of a promisor remote, and
`pr-url` the urlencoded URL of that promisor remote.
In this case, if the client decides to use one or more promisor
remotes the server advertised, it can reply with
"promisor-remote=<pr-names>" where <pr-names> should be of the form:
pr-names = pr-name | pr-names ";" pr-name
where `pr-name` is the urlencoded name of a promisor remote the server
advertised and the client accepts.
Note that, everywhere in this document, `pr-name` MUST be a valid
remote name, and the ';' and ',' characters MUST be encoded if they
appear in `pr-name` or `pr-url`.
If the server doesn't know any promisor remote that could be good for
a client to use, or prefers a client not to use any promisor remote it
uses or knows about, it shouldn't advertise the "promisor-remote"
capability at all.
In this case, or if the client doesn't want to use any promisor remote
the server advertised, the client shouldn't advertise the
"promisor-remote" capability at all in its reply.
The "promisor.advertise" and "promisor.acceptFromServer" configuration
options can be used on the server and client side respectively to
control what they advertise or accept respectively. See the
documentation of these configuration options for more information.
Note that in the future it would be nice if the "promisor-remote"
protocol capability could be used by the server, when responding to
`git fetch` or `git clone`, to advertise better-connected remotes that
the client can use as promisor remotes, instead of this repository, so
that the client can lazily fetch objects from these other
better-connected remotes. This would require the server to omit in its
response the objects available on the better-connected remotes that
the client has accepted. This hasn't been implemented yet though. So
for now this "promisor-remote" capability is useful only when the
server advertises some promisor remotes it already uses to borrow
objects from.
GIT
---
Part of the linkgit:git[1] suite
1 change: 1 addition & 0 deletions Documentation/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ manpages = {
'git-apply.adoc' : 1,
'git-archimport.adoc' : 1,
'git-archive.adoc' : 1,
'git-backfill.adoc' : 1,
'git-bisect.adoc' : 1,
'git-blame.adoc' : 1,
'git-branch.adoc' : 1,
Expand Down
Loading

0 comments on commit fcae86a

Please sign in to comment.