1
0
mirror of https://github.com/git/git.git synced 2024-10-21 06:59:20 +02:00
git/refs
Han-Wen Nienhuys 1ae6ed230a refs/files-backend: stop setting errno from lock_ref_oid_basic
refs/files-backend.c::lock_ref_oid_basic() tries to signal how it failed
to its callers using errno.

It is safe to stop setting errno here, because the callers of this
file-scope static function are

* files_copy_or_rename_ref()
* files_create_symref()
* files_reflog_expire()

None of them looks at errno after seeing a negative return from
lock_ref_oid_basic() to make any decision, and no caller of these three
functions looks at errno after they signal a failure by returning a
negative value. In particular,

* files_copy_or_rename_ref() - here, calls are followed by error()
(which performs I/O) or write_ref_to_lockfile() (which calls
parse_object() which may perform I/O)

* files_create_symref() - here, calls are followed by error() or
create_symref_locked() (which performs I/O and does not inspect
errno)

* files_reflog_expire() - here, calls are followed by error() or
refs_reflog_exists() (which calls a function in a vtable that is not
documented to use and/or preserve errno)

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-08-25 13:30:26 -07:00
..
debug.c refs API: remove OID argument to reflog_expire() 2021-08-25 13:27:37 -07:00
files-backend.c refs/files-backend: stop setting errno from lock_ref_oid_basic 2021-08-25 13:30:26 -07:00
iterator.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
packed-backend.c refs API: remove OID argument to reflog_expire() 2021-08-25 13:27:37 -07:00
packed-backend.h refs/packed-backend.h: add missing declaration (hdr-check) 2018-09-20 11:50:00 -07:00
ref-cache.c refs: make explicit that ref_iterator_peel returns boolean 2021-05-20 07:54:12 +09:00
ref-cache.h
refs-internal.h refs: remove EINVAL errno output from specification of read_raw_ref_fn 2021-08-25 13:30:26 -07:00