Skip to content

Commit

Permalink
pack-objects: create new name-hash algorithm (#5157)
Browse files Browse the repository at this point in the history
This is an updated version of gitgitgadget#1785, intended for early
consumption into Git for Windows.

The idea here is to add a new `--full-name-hash` option to `git
pack-objects` and `git repack`. This adjusts the name-hash value used
for finding delta bases in such a way that uses the full path name with
a lower likelihood of collisions than the default name-hash algorithm.
In many repositories with name-hash collisions and many versions of
those paths, this can significantly reduce the size of a full repack. It
can also help in certain cases of `git push`, but only if the pack is
already artificially inflated by name-hash collisions; cases that find
"sibling" deltas as better choices become worse with `--full-name-hash`.

Thus, this option is currently recommended for full repacks of large
repos, and on client machines without reachability bitmaps.

Some care is taken to ignore this option when using bitmaps, either
writing bitmaps or using a bitmap walk during reads. The bitmap file
format contains name-hash values, but no way to indicate which function
is used, so compatibility is a concern for bitmaps. Future work could
explore this idea.

After this PR is merged, then the more-involved `--path-walk` option may
be considered.
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Feb 28, 2025
2 parents 5e695ea + d6d01f1 commit 07908cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion t/t5551-http-fetch-smart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,15 @@ test_expect_success CMDLINE_LIMIT \
)
'

test_expect_success 'large fetch-pack requests can be sent using chunked encoding' '
# This is a temporary work-around for libcurl v8.10.0 on the macos-* runners;
# see https://github.com/git-for-windows/git/issues/5159 for full details
test_lazy_prereq UNBROKEN_HTTP2 '
test "$HTTP_PROTO" = HTTP/2 &&
test -z "$(brew info -q curl 2>/dev/null |
sed -n "/^Installed/{N;s/.*8\\.10\\.0.*/BROKEN HTTP2/p;}")"
'

test_expect_success UNBROKEN_HTTP2 'large fetch-pack requests can be sent using chunked encoding' '
GIT_TRACE_CURL=true git -c http.postbuffer=65536 \
clone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&
{
Expand Down

0 comments on commit 07908cf

Please sign in to comment.