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

Re: [PATCH 1/3] refs: make sha1 output parameter of refs_resolve_ref_unsafe() optional

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 24, 2017, 01:26 UTC
Message-ID
<xmqq60c8j38t.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<b89d36b5-0996-829b-a267-7ee4da9673dc@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 7 quoted lines
> Allow callers of refs_resolve_ref_unsafe() to pass NULL if they don't
> need the resolved hash value.  We already allow the same for the flags
> parameter.  This new leniency is inherited by the various wrappers like
> resolve_ref_unsafe().
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---

The patches all make sense, and I'd expect them to be something a competent contributor would write after coming to this realization: it seems that many many callers, when they have a ref that could be a symbolic ref, want to learn (1) if it is a symref and (2) where it points at, and nothing else, most notably they do not care what the object pointed by the (symbolic) ref is.

I wonder if we want a dedicated helper for them (perhaps about a dozen callers we have that fall into this pattern?) to call for the exact purpose, implemented as a thin-wrapper around the resolve_ref_unsafe() function, though.

Thanks.
Previous: René ScharfeNext: René Scharfe
Message 4 of 8 in “refs: make sha1 output parameter of refs_resolve_ref_unsafe() optional”
  1. 1/3 refs: make sha1 output parameter of refs_resolve_ref_unsafe() optionalRené Scharfe, Sep 23, 2017
  2. 2/3 refs: pass NULL to refs_resolve_ref_unsafe() if hash is not neededRené Scharfe, Sep 23, 2017
  3. 3/3 refs: pass NULL to resolve_ref_unsafe() if hash is not neededRené Scharfe, Sep 23, 2017
  4. Junio C HamanoSep 24, 2017
  5. René ScharfeSep 24, 2017
  6. 4/3 refs: pass NULL to refs_resolve_refdup() if hash is not neededRené Scharfe, Oct 1, 2017
  7. 5/3 refs: pass NULL to resolve_refdup() if hash is not neededRené Scharfe, Oct 1, 2017
  8. Junio C HamanoOct 1, 2017

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.