git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 0/3] For v2.35.0: refs: ab/refs-errno-cleanup fixup + remove "failure_errno"

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 12, 2022, 12:36 UTC
Message-ID
<cover-v3-0.3-00000000000-20220112T123117Z-avarab@gmail.com>
In-Reply-To
<cover-v2-0.3-00000000000-20211212T195108Z-avarab@gmail.com>

This is a follow-up to the recently landed ab/refs-errno-cleanup topic, I missed a spot and left some meaningless use of "errno" in the refs (file) backend.

Per the $subject I hope we can get this into v2.35.0. I submitted a v1[1] and v2[2] of this around the holidays so I think it may have fallen through the cracks.

1. https://lore.kernel.org/git/cover-0.3-00000000000-20211209T045735Z-avarab@gmail.com/
2. https://lore.kernel.org/git/cover-v2-0.3-00000000000-20211212T195108Z-avarab@gmail.com/
Ævar Arnfjörð Bjarmason (3):
  refs API: use "failure_errno", not "errno"
  sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failure
  refs API: remove "failure_errno" from refs_resolve_ref_unsafe()
 refs.c                    | 53 +++++++++++++--------------------------
 refs.h                    |  7 +-----
 refs/files-backend.c      | 34 ++++++++-----------------
 remote.c                  |  3 +--
 sequencer.c               | 10 +++-----
 t/helper/test-ref-store.c |  3 +--
 worktree.c                | 11 +++-----
 7 files changed, 36 insertions(+), 85 deletions(-)
Range-diff against v2:
1:  161fcad1578 = 1:  a45268ac24b refs API: use "failure_errno", not "errno"
2:  12d453d3884 = 2:  8d8691a5e93 sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failure
3:  614590b2d10 ! 3:  8f937d8f64a refs API: remove "failure_errno" from refs_resolve_ref_unsafe()
    @@ Commit message
         return value was NULL or not, i.e. if the ref could be resolved.
     
         There was one caller left in sequencer.c that used the
    -    "failure_errnO', but as of the preceding commit it doesn't use that
    -    "failure_errno" either.
    +    "failure_errno', but as of the preceding commit it uses a boilerplate
    +    "ignore_errno" instead.
     
         So let's remove this output parameter. Not only isn't it used now, but
    -    we'd like to slowly move the refs API to a more file-backend
    -    independent way of communicating error codes, having it use a
    -    "failure_errno" was only the first step in that direction. If this or
    -    any other function needs to communicate what specifically is wrong
    -    with the requested "refname" it'll be better to have the function set
    -    some output enum of well-defined error states than piggy-backend on
    -    "errno".
    +    it's unlikely that we'll want it again in the future. We'd like to
    +    slowly move the refs API to a more file-backend independent way of
    +    communicating error codes, having it use a "failure_errno" was only
    +    the first step in that direction. If this or any other function needs
    +    to communicate what specifically is wrong with the requested "refname"
    +    it'll be better to have the function set some output enum of
    +    well-defined error states than piggy-backend on "errno".
     
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
    @@ refs/files-backend.c: static int lock_ref_for_update(struct files_ref_store *ref
      						    "error reading reference",
     @@ refs/files-backend.c: static int files_reflog_expire(struct ref_store *ref_store,
      
    - 		if ((flags & EXPIRE_REFLOGS_UPDATE_REF) &&
    + 		if ((expire_flags & EXPIRE_REFLOGS_UPDATE_REF) &&
      		    !is_null_oid(&cb.last_kept_oid)) {
     -			int ignore_errno;
      			int type;
    @@ sequencer.c: void print_commit_summary(struct repository *r,
     
      ## t/helper/test-ref-store.c ##
     @@ t/helper/test-ref-store.c: static int cmd_resolve_ref(struct ref_store *refs, const char **argv)
    - 	int resolve_flags = arg_flags(*argv++, "resolve-flags");
    + 	int resolve_flags = arg_flags(*argv++, "resolve-flags", empty_flags);
      	int flags;
      	const char *ref;
     -	int ignore_errno;
    @@ worktree.c: static void add_head_info(struct worktree *wt)
      	if (!target)
      		return;
      
    -@@ worktree.c: const struct worktree *find_shared_symref(const char *symref,
    +@@ worktree.c: const struct worktree *find_shared_symref(struct worktree **worktrees,
      		const char *symref_target;
      		struct ref_store *refs;
      		int flags;
    @@ worktree.c: const struct worktree *find_shared_symref(const char *symref,
      
      		if (wt->is_bare)
      			continue;
    -@@ worktree.c: const struct worktree *find_shared_symref(const char *symref,
    +@@ worktree.c: const struct worktree *find_shared_symref(struct worktree **worktrees,
      
      		refs = get_worktree_ref_store(wt);
      		symref_target = refs_resolve_ref_unsafe(refs, symref, 0,
-- 
2.35.0.rc0.848.gb9d3879eb1d
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 13 of 28 in “errno oversight”
  1. Han-Wen NienhuysDec 8, 2021
  2. Ævar Arnfjörð BjarmasonDec 8, 2021
  3. Ævar Arnfjörð BjarmasonDec 8, 2021
  4. Junio C HamanoDec 8, 2021
  5. 0/3 refs: ab/refs-errno-cleanup fixup + remove "failure_errno"Ævar Arnfjörð Bjarmason, Dec 9, 2021
  6. 1/3 refs API: use "failure_errno", not "errno"Ævar Arnfjörð Bjarmason, Dec 9, 2021
  7. 2/3 sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failureÆvar Arnfjörð Bjarmason, Dec 9, 2021
  8. 3/3 refs API: remove "failure_errno" from refs_resolve_ref_unsafe()Ævar Arnfjörð Bjarmason, Dec 9, 2021
  9. 0/3 refs: ab/refs-errno-cleanup fixup + remove "failure_errno"Ævar Arnfjörð Bjarmason, Dec 12, 2021
  10. 1/3 refs API: use "failure_errno", not "errno"Ævar Arnfjörð Bjarmason, Dec 12, 2021
  11. 2/3 sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failureÆvar Arnfjörð Bjarmason, Dec 12, 2021
  12. 3/3 refs API: remove "failure_errno" from refs_resolve_ref_unsafe()Ævar Arnfjörð Bjarmason, Dec 12, 2021
  13. 0/3 For v2.35.0: refs: ab/refs-errno-cleanup fixup + remove "failure_errno"Ævar Arnfjörð Bjarmason, Jan 12, 2022
  14. 1/3 refs API: use "failure_errno", not "errno"Ævar Arnfjörð Bjarmason, Jan 12, 2022
  15. Junio C HamanoJan 12, 2022
  16. Ævar Arnfjörð BjarmasonJan 13, 2022
  17. 2/3 sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failureÆvar Arnfjörð Bjarmason, Jan 12, 2022
  18. Junio C HamanoJan 12, 2022
  19. 3/3 refs API: remove "failure_errno" from refs_resolve_ref_unsafe()Ævar Arnfjörð Bjarmason, Jan 12, 2022
  20. Junio C HamanoJan 12, 2022
  21. Ævar Arnfjörð BjarmasonJan 13, 2022
  22. Junio C HamanoJan 13, 2022
  23. Ævar Arnfjörð BjarmasonJan 14, 2022
  24. 0/2 refs: remove the last use of "errno" from the public APIÆvar Arnfjörð Bjarmason, Jan 26, 2022
  25. 1/2 sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failureÆvar Arnfjörð Bjarmason, Jan 26, 2022
  26. Junio C HamanoJan 26, 2022
  27. 2/2 refs API: remove "failure_errno" from refs_resolve_ref_unsafe()Ævar Arnfjörð Bjarmason, Jan 26, 2022
  28. Han-Wen NienhuysDec 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.