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

Re: [PATCH v7 07/11] refs/refs-internal.h: new header file

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Nov 9, 2015, 19:46 UTC
Message-ID
<5640F823.5010902@ramsayjones.plus.com>
In-Reply-To
<5f62351689318a4ef9feeb3639e6a7a00b354a02.1447085798.git.mhagger@alum.mit.edu>
On 09/11/15 17:03, Michael Haggerty wrote:
Show 31 quoted lines
> There are a number of constants, structs, and static functions defined
> in refs.c and treated as private to the references module. But we want
> to support multiple reference backends within the reference module,
> and those backends will need access to some heretofore private
> declarations.
> 
> We don't want those declarations to be visible to non-refs code, so we
> don't want to move them to refs.h. Instead, add a new header file,
> refs/refs-internal.h, that is intended to be included only from within
> the refs module. Make some functions non-static and move some
> declarations (and their corresponding docstrings) from refs.c to this
> file.
> 
> In a moment we will add more content to the "refs" subdirectory.
> 
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
>  refs.c               | 175 +++----------------------------------------------
>  refs/refs-internal.h | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 191 insertions(+), 166 deletions(-)
>  create mode 100644 refs/refs-internal.h
> 
> diff --git a/refs.c b/refs.c
> index f48c58a..9aff0c8 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1,6 +1,6 @@
>  #include "cache.h"
> +#include "refs/refs-internal.h"
>  #include "lockfile.h"
> -#include "refs.h"

This looked wrong to me, until I had read the remainder of the patch and noticed that the 'internal' header #included the 'public' interface header.

Unfortunately, this still feels wrong to me! I would rather that the internal header _not_ include the public header (so, include them _both_ when necessary). Just my opinion, which you can simply ignore. :-D

ATB, Ramsay Jones

Previous: Michael HaggertyNext: David Turner
Message 12 of 18 in “refs backend pre-vtable”
  1. 00/11 refs backend pre-vtableMichael Haggerty, Nov 9, 2015
  2. 01/11 refs: make is_branch publicMichael Haggerty, Nov 9, 2015
  3. Ramsay JonesNov 9, 2015
  4. David TurnerNov 9, 2015
  5. Michael HaggertyNov 10, 2015
  6. 02/11 verify_refname_available(): rename functionMichael Haggerty, Nov 9, 2015
  7. 03/11 verify_refname_available(): new functionMichael Haggerty, Nov 9, 2015
  8. 04/11 copy_msg(): rename to copy_reflog_msg()Michael Haggerty, Nov 9, 2015
  9. 05/11 pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref()Michael Haggerty, Nov 9, 2015
  10. 06/11 refname_is_safe(): improve docstringMichael Haggerty, Nov 9, 2015
  11. 07/11 refs/refs-internal.h: new header fileMichael Haggerty, Nov 9, 2015
  12. Ramsay JonesNov 9, 2015
  13. David TurnerNov 9, 2015
  14. Michael HaggertyNov 10, 2015
  15. 09/11 initdb: make safe_create_dir publicMichael Haggerty, Nov 9, 2015
  16. 10/11 files_log_ref_write: new functionMichael Haggerty, Nov 9, 2015
  17. 11/11 refs: break out ref conflict checksMichael Haggerty, Nov 9, 2015
  18. David TurnerNov 9, 2015

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.