]> git.ipfire.org Git - thirdparty/git.git/commit - commit-graph.c
commit-graph.h: replace 'commit_hex' with 'commits'
authorTaylor Blau <me@ttaylorr.com>
Tue, 14 Apr 2020 04:04:25 +0000 (22:04 -0600)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Apr 2020 16:20:30 +0000 (09:20 -0700)
commit6830c360777468434184f60023e2562348c9dacc
tree1cf8125fb2e1d96f34115fee5aebae075a7ab414
parentf4781068faafad5e10fb6e8ae312ebd5b0e7bb55
commit-graph.h: replace 'commit_hex' with 'commits'

The 'write_commit_graph()' function takes in either a string list of
pack indices, or a string list of hexadecimal commit OIDs. These
correspond to the '--stdin-packs' and '--stdin-commits' mode(s) from
'git commit-graph write'.

Using a string_list of hexadecimal commit IDs is not the most efficient
use of memory, since we can instead use the 'struct oidset', which is
more well-suited for this case.

This has another benefit which will become apparent in the following
commit. This is that we are about to disambiguate the kinds of errors we
produce with '--stdin-commits' into "non-hex input" and "hex-input, but
referring to a non-commit object". By having 'write_commit_graph' take
in a 'struct oidset *' of commits, we place the burden on the caller (in
this case, the builtin) to handle the first case, and the commit-graph
machinery can handle the second case.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit-graph.c
commit-graph.c
commit-graph.h
t/t5318-commit-graph.sh