]> git.ipfire.org Git - thirdparty/git.git/commit - commit-graph.h
commit-graph: return with errors during write
authorDerrick Stolee <dstolee@microsoft.com>
Wed, 12 Jun 2019 13:29:37 +0000 (06:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Jun 2019 18:20:53 +0000 (11:20 -0700)
commite103f7276f0d809c2935ebc1a3d68c6bbfaed23d
tree8d28ceab6dcdd7ff7e7400a15ffa54cf649a2565
parentc7944050af45c7384f97c712cb4d126672c7cfa6
commit-graph: return with errors during write

The write_commit_graph() method uses die() to report failure and
exit when confronted with an unexpected condition. This use of
die() in a library function is incorrect and is now replaced by
error() statements and an int return type. Return zero on success
and a negative value on failure.

Now that we use 'goto cleanup' to jump to the terminal condition
on an error, we have new paths that could lead to uninitialized
values. New initializers are added to correct for this.

The builtins 'commit-graph', 'gc', and 'commit' call these methods,
so update them to check the return value. Test that 'git commit-graph
write' returns a proper error code when hitting a failure condition
in write_commit_graph().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit-graph.c
builtin/commit.c
builtin/gc.c
commit-graph.c
commit-graph.h
t/t5318-commit-graph.sh