Skip to content
Open

Jch #2105

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
fb78702
refs: avoid "too many arguments"
gitster Aug 6, 2024
becacd2
cat-file: avoid "too many arguments"
gitster Aug 6, 2024
2446e8f
notes: avoid "too many arguments"
gitster Aug 6, 2024
6c8ee88
miscellaneous: avoid "too many arguments"
gitster Aug 6, 2024
1e77bf0
packfile: move sizep computation
peff Aug 23, 2024
117addc
packfile: allow content-limit for cat-file
peff Aug 23, 2024
b2df0c0
packfile: fix off-by-one in content_limit comparison
Aug 23, 2024
a5f683f
packfile: inline cache_or_unpack_entry
Aug 23, 2024
98521d6
cat-file: use delta_base_cache entries directly
Aug 23, 2024
28402bc
packfile: packed_object_info avoids packed_to_object_type
Aug 23, 2024
7d4e4d5
object_info: content_limit only applies to blobs
Aug 23, 2024
489810f
cat-file: batch-command uses content_limit
Aug 23, 2024
1732dda
cat-file: batch_write: use size_t for length
Aug 23, 2024
f043683
cat-file: use writev(2) if available
Aug 23, 2024
31c5b4b
version: refactor strbuf_sanitize()
chriscool Sep 10, 2024
8afd0ee
strbuf: refactor strbuf_trim_trailing_ch()
chriscool Sep 10, 2024
3cb155a
Add 'promisor-remote' capability to protocol v2
chriscool Sep 10, 2024
bc0c4e1
promisor-remote: check advertised name or URL
chriscool Sep 10, 2024
82d283c
t7500: make each piece more independent
gitster Oct 14, 2024
dbafaff
config: values of pathname type can be prefixed with :(optional)
gitster Oct 14, 2024
2da08f2
parseopt: values of pathname type can be prefixed with :(optional)
gitster Oct 14, 2024
bed4d80
builtin/ls-remote: plug leaking server options
pks-t Oct 21, 2024
bfac141
t/helper: fix leaks in "reach" test tool
pks-t Oct 21, 2024
f4bb632
grep: fix leak in `grep_splice_or()`
pks-t Oct 21, 2024
4042f03
builtin/grep: fix leak with `--max-count=0`
pks-t Oct 21, 2024
ab28bc8
revision: fix leaking bloom filters
pks-t Oct 21, 2024
27a1c1f
diff-lib: fix leaking diffopts in `do_diff_cache()`
pks-t Oct 21, 2024
c0a1026
pretty: clear signature check
pks-t Oct 21, 2024
5ca4de4
upload-pack: fix leaking URI protocols
pks-t Oct 21, 2024
27164f7
builtin/commit: fix leaking change data contents
pks-t Oct 21, 2024
ecbb58e
trailer: fix leaking trailer values
pks-t Oct 21, 2024
9d0482d
trailer: fix leaking strbufs when formatting trailers
pks-t Oct 21, 2024
06d6581
builtin/commit: fix leaking cleanup config
pks-t Oct 21, 2024
7c66167
transport-helper: fix leaking import/export marks
pks-t Oct 21, 2024
8eded2f
builtin/tag: fix leaking key ID on failure to sign
pks-t Oct 21, 2024
9a2c5b0
combine-diff: fix leaking lost lines
pks-t Oct 21, 2024
8977bcf
dir: release untracked cache data
pks-t Oct 21, 2024
1fe066c
sparse-index: correctly free EWAH contents
pks-t Oct 21, 2024
a4a3b8c
t/helper: stop re-initialization of `the_repository`
pks-t Oct 21, 2024
44cbc97
t/helper: fix leaking buffer in "dump-untracked-cache"
pks-t Oct 21, 2024
e0e970d
dir: fix leak when parsing "status.showUntrackedFiles"
pks-t Oct 21, 2024
3ec42f3
builtin/merge: release outbut buffer after performing merge
pks-t Oct 21, 2024
931847a
list-objects-filter-options: work around reported leak on error
pks-t Oct 21, 2024
e6e6315
reftable/system: move "dir.h" to its only user
pks-t Oct 23, 2024
ac90e9f
reftable: explicitly handle hash format IDs
pks-t Oct 23, 2024
da2d199
reftable/system: stop depending on "hash.h"
pks-t Oct 23, 2024
3c58a50
reftable/stack: stop using `fsync_component()` directly
pks-t Oct 23, 2024
3f5e8d2
reftable/system: provide thin wrapper for tempfile subsystem
pks-t Oct 23, 2024
ec282c1
reftable/stack: drop only use of `get_locked_file_path()`
pks-t Oct 23, 2024
3740325
reftable/system: provide thin wrapper for lockfile subsystem
pks-t Oct 23, 2024
ae0f757
compat/mingw: support POSIX semantics for atomic renames
pks-t Oct 27, 2024
0142990
show-index: fix uninitialized hash function
quanta-kt Oct 26, 2024
2be7127
Documentation/git-bundle.txt: mention full backup example
LemmingAvalanche Oct 29, 2024
4f68a40
Documentation/git-bundle.txt: mention --all in spec. refs
LemmingAvalanche Oct 29, 2024
c4ac5fa
Documentation/git-bundle.txt: discuss naïve backups
LemmingAvalanche Oct 29, 2024
fcae55a
fetch-pack: refactor packet writing
calvin-wan-google Oct 28, 2024
9ddf78d
fetch-pack: move fetch initialization
calvin-wan-google Oct 28, 2024
bc52916
serve: advertise object-info feature
calvin-wan-google Oct 28, 2024
8c4368d
transport: add client support for object-info
calvin-wan-google Oct 28, 2024
f1ffe74
cat-file: add declaration of variable i inside its for loop
peijianju Oct 28, 2024
999bed8
cat-file: add remote-object-info to batch-command
peijianju Oct 28, 2024
d9b67c3
path-walk: introduce an object walk by path
derrickstolee Oct 31, 2024
44425c4
test-lib-functions: add test_cmp_sorted
derrickstolee Oct 31, 2024
35e6cf9
t6601: add helper for testing path-walk API
derrickstolee Oct 31, 2024
ca51c2d
path-walk: allow consumer to specify object types
derrickstolee Oct 31, 2024
8fa5e62
path-walk: visit tags and cached objects
derrickstolee Oct 31, 2024
c99f26c
path-walk: mark trees and blobs as UNINTERESTING
derrickstolee Oct 31, 2024
d18caa1
Merge branch 'kn/arbitrary-suffixes' into jch
ttaylorr Nov 1, 2024
fbed493
Merge branch 'kn/ci-clang-format-tidy' into jch
ttaylorr Nov 1, 2024
46be1b3
Merge branch 'cw/config-extensions' into jch
ttaylorr Nov 1, 2024
1597170
Merge branch 'ps/upgrade-clar' into jch
ttaylorr Nov 1, 2024
5b107fa
###
ttaylorr Nov 1, 2024
ff12b90
Merge branch 'jk/left-right-bitmap' into jch
ttaylorr Nov 1, 2024
8f346e1
### match next
ttaylorr Nov 1, 2024
ce4ffbd
Merge branch 'ej/cat-file-remote-object-info' into jch
ttaylorr Nov 1, 2024
5215bb8
Merge branch 'ps/mingw-rename' into jch
ttaylorr Nov 1, 2024
5640c87
Merge branch 'ps/reftable-detach' into jch
ttaylorr Nov 1, 2024
7be0046
Merge branch 'cc/promisor-remote-capability' into jch
ttaylorr Nov 1, 2024
96e5742
Merge branch 'jc/too-many-arguments' into jch
ttaylorr Nov 1, 2024
04bc973
Merge branch 'ew/cat-file-optim' into jch
ttaylorr Nov 1, 2024
71cf160
Merge branch 'bc/drop-ancient-libcurl-and-perl' into jch
ttaylorr Nov 1, 2024
f0176fb
Merge branch 'jc/optional-path' into jch
ttaylorr Nov 1, 2024
ddedb0e
Merge branch 'ps/leakfixes-part-9' into jch
ttaylorr Nov 1, 2024
2f42bd7
Merge branch 'as/show-index-uninitialized-hash' into jch
ttaylorr Nov 1, 2024
c65c75b
Merge branch 'kh/bundle-docs' into jch
ttaylorr Nov 1, 2024
5212635
Merge branch 'ds/path-walk-1' into jch
ttaylorr Nov 1, 2024
515fd3a
Merge branch 'bc/ancient-ci' into jch
ttaylorr Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reftable: explicitly handle hash format IDs
The hash format IDs are used for two different things across the
reftable codebase:

  - They are used as a 32 bit unsigned integer when reading and writing
    the header in order to identify the hash function.

  - They are used internally to identify which hash function is in use.

When one only considers the second usecase one might think that one can
easily change the representation of those hash IDs. But because those
IDs end up in the reftable header and footer on disk it is important
that those never change.

Create separate constants `REFTABLE_FORMAT_ID_*` and use them in
contexts where we read or write reftable headers. This serves multiple
purposes:

  - It allows us to more easily discern cases where we actually use
    those constants for the on-disk format.

  - It detangles us from the same constants that are defined in
    libgit.a, which is another required step to convert the reftable
    library to become standalone.

  - It makes the next step easier where we stop using `GIT_*_FORMAT_ID`
    constants in favor of a custom enum.

Signed-off-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Taylor Blau <[email protected]>
  • Loading branch information
pks-t authored and ttaylorr committed Oct 23, 2024
commit ac90e9f0b171cf91f2c103e9c77de919d8cd42c6
7 changes: 7 additions & 0 deletions reftable/basics.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,11 @@ int common_prefix_size(struct reftable_buf *a, struct reftable_buf *b);

int hash_size(uint32_t id);

/*
* Format IDs that identify the hash function used by a reftable. Note that
* these constants end up on disk and thus mustn't change.
*/
#define REFTABLE_FORMAT_ID_SHA1 ((uint32_t) 0x73686131)
#define REFTABLE_FORMAT_ID_SHA256 ((uint32_t) 0x73323536)

#endif
10 changes: 6 additions & 4 deletions reftable/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,18 @@ static int parse_footer(struct reftable_reader *r, uint8_t *footer,
if (r->version == 1) {
r->hash_id = GIT_SHA1_FORMAT_ID;
} else {
r->hash_id = get_be32(f);
switch (r->hash_id) {
case GIT_SHA1_FORMAT_ID:
switch (get_be32(f)) {
case REFTABLE_FORMAT_ID_SHA1:
r->hash_id = GIT_SHA1_FORMAT_ID;
break;
case GIT_SHA256_FORMAT_ID:
case REFTABLE_FORMAT_ID_SHA256:
r->hash_id = GIT_SHA256_FORMAT_ID;
break;
default:
err = REFTABLE_FORMAT_ERROR;
goto done;
}

f += 4;
}

Expand Down
16 changes: 15 additions & 1 deletion reftable/writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,22 @@ static int writer_write_header(struct reftable_writer *w, uint8_t *dest)
put_be64(dest + 8, w->min_update_index);
put_be64(dest + 16, w->max_update_index);
if (writer_version(w) == 2) {
put_be32(dest + 24, w->opts.hash_id);
uint32_t hash_id;

switch (w->opts.hash_id) {
case GIT_SHA1_FORMAT_ID:
hash_id = REFTABLE_FORMAT_ID_SHA1;
break;
case GIT_SHA256_FORMAT_ID:
hash_id = REFTABLE_FORMAT_ID_SHA256;
break;
default:
return -1;
}

put_be32(dest + 24, hash_id);
}

return header_size(writer_version(w));
}

Expand Down