Skip to content

Commit e599fe2

Browse files
committed
pack-objects: create new name-hash algorithm (#5157)
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.
2 parents 1b9a293 + 4d481a8 commit e599fe2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/pack-objects.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4439,7 +4439,7 @@ int cmd_pack_objects(int argc,
44394439
N_("protocol"),
44404440
N_("exclude any configured uploadpack.blobpackfileuri with this protocol")),
44414441
OPT_BOOL(0, "full-name-hash", &use_full_name_hash,
4442-
N_("optimize delta compression across identical path names over time")),
4442+
N_("(EXPERIMENTAL!) optimize delta compression across identical path names over time")),
44434443
OPT_END(),
44444444
};
44454445

builtin/repack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ int cmd_repack(int argc,
12091209
OPT_BOOL('F', NULL, &po_args.no_reuse_object,
12101210
N_("pass --no-reuse-object to git-pack-objects")),
12111211
OPT_BOOL(0, "full-name-hash", &po_args.full_name_hash,
1212-
N_("pass --full-name-hash to git-pack-objects")),
1212+
N_("(EXPERIMENTAL!) pass --full-name-hash to git-pack-objects")),
12131213
OPT_NEGBIT('n', NULL, &run_update_server_info,
12141214
N_("do not run git-update-server-info"), 1),
12151215
OPT__QUIET(&po_args.quiet, N_("be quiet")),

0 commit comments

Comments
 (0)