git/Documentation/technical
Ævar Arnfjörð Bjarmason 0cc05b044f usage.c: add a non-fatal bug() function to go with BUG()
Add a bug() function to use in cases where we'd like to indicate a
runtime BUG(), but would like to defer the BUG() call because we're
possibly accumulating more bug() callers to exhaustively indicate what
went wrong.

We already have this sort of facility in various parts of the
codebase, just in the form of ad-hoc re-inventions of the
functionality that this new API provides. E.g. this will be used to
replace optbug() in parse-options.c, and the 'error("BUG:[...]' we do
in a loop in builtin/receive-pack.c.

Unlike the code this replaces we'll log to trace2 with this new bug()
function (as with other usage.c functions, including BUG()), we'll
also be able to avoid calls to xstrfmt() in some cases, as the bug()
function itself accepts variadic sprintf()-like arguments.

Any caller to bug() can follow up such calls with BUG_if_bug(),
which will BUG() out (i.e. abort()) if there were any preceding calls
to bug(), callers can also decide not to call BUG_if_bug() and leave
the resulting BUG() invocation until exit() time. There are currently
no bug() API users that don't call BUG_if_bug() themselves after a
for-loop, but allowing for not calling BUG_if_bug() keeps the API
flexible. As the tests and documentation here show we'll catch missing
BUG_if_bug() invocations in our exit() wrapper.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-02 12:51:35 -07:00
..
.gitignore
api-error-handling.txt usage.c: add a non-fatal bug() function to go with BUG() 2022-06-02 12:51:35 -07:00
api-index-skel.txt
api-index.sh
api-merge.txt
api-parse-options.txt parse-options API: remove OPTION_ARGUMENT feature 2021-09-12 23:27:38 -07:00
api-simple-ipc.txt simple-ipc: design documentation for new IPC mechanism 2021-03-15 14:32:50 -07:00
api-trace2.txt usage.c: add a non-fatal bug() function to go with BUG() 2022-06-02 12:51:35 -07:00
bitmap-format.txt Documentation: describe MIDX-based bitmaps 2021-08-24 13:21:13 -07:00
bundle-format.txt bundle: parse filter capability 2022-03-09 10:25:27 -08:00
chunk-format.txt chunk-format: add technical docs 2021-02-18 13:38:16 -08:00
commit-graph-format.txt commit-graph: declare bankruptcy on GDAT chunks 2022-03-07 09:17:03 -08:00
commit-graph.txt doc: add corrected commit date info 2021-01-18 16:21:18 -08:00
directory-rename-detection.txt directory-rename-detection.txt: small updates due to merge-ort optimizations 2021-08-05 08:57:39 -07:00
hash-function-transition.txt *: fix typos which duplicate a word 2021-06-14 10:16:06 +09:00
http-protocol.txt upload-pack: document and rename --advertise-refs 2021-08-05 08:59:37 -07:00
index-format.txt sparse-index: add 'sdir' index extension 2021-03-30 12:57:46 -07:00
long-running-process-protocol.txt
multi-pack-index.txt midx.c: make changing the preferred pack safe 2022-01-27 12:07:52 -08:00
pack-format.txt midx.c: make changing the preferred pack safe 2022-01-27 12:07:52 -08:00
pack-heuristics.txt
pack-protocol.txt Merge branch 'jx/proc-receive-hook' 2020-09-25 15:25:39 -07:00
packfile-uri.txt packfile-uri.txt: fix blobPackfileUri description 2021-05-25 09:31:06 +09:00
parallel-checkout.txt parallel-checkout: add design documentation 2021-04-19 15:05:25 -07:00
partial-clone.txt docs: mention --refetch fetch option 2022-03-28 10:25:53 -07:00
protocol-capabilities.txt docs: new capability to advertise session IDs 2020-11-11 18:26:52 -08:00
protocol-common.txt
protocol-v2.txt Merge branch 'cw/protocol-v2-doc-fix' 2021-12-10 14:35:00 -08:00
racy-git.txt
reftable.txt Documentation: object_id_len goes up to 31 2022-02-23 13:36:26 -08:00
remembering-renames.txt t6429: testcases for remembering renames 2021-05-20 15:40:39 +09:00
repository-version.txt
rerere.txt update documentation for new zdiff3 conflictStyle 2021-12-01 14:45:59 -08:00
send-pack-pipeline.txt
shallow.txt shallow.txt: document SHA-256 shallow format 2020-08-17 10:35:13 -07:00
signature-format.txt signature-format.txt: explain and illustrate multi-line headers 2021-10-12 19:06:24 -07:00
sparse-index.txt sparse-index: API protection strategy 2021-04-14 13:45:34 -07:00
trivial-merge.txt