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

Re: [PATCH v2 1/1] xdiff: provide indirection to git functions

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2022, 19:03 UTC
Message-ID
<xmqq4k4mdb0i.fsf@gitster.g>
In-Reply-To
<20220217225408.GB7@edef91d97c94>
Edward Thomson <ethomson@edwardthomson.com> writes:
Show 6 quoted lines
> Provide an indirection layer into the git-specific functionality and
> utilities in `git-xdiff.h`, prefixing those types and functions with
> `xdl_` (and `XDL_` for macros).  This allows other projects that use
> git's xdiff implementation to keep up-to-date; they can now take all the
> files _except_ `git-xdiff.h`, which they have customized for their own
> environment.

Continuing the "what do they exactly do" line of thought, the above is not quite in line with what I heard. They take all the files including git-xdiff.h and they must modify git-xdiff.h to match their environment.

In any case, ...
Show 8 quoted lines
> diff --git a/xdiff/git-xdiff.h b/xdiff/git-xdiff.h
> new file mode 100644
> index 0000000000..664a7c1351
> --- /dev/null
> +++ b/xdiff/git-xdiff.h
> @@ -0,0 +1,16 @@
> +#ifndef GIT_XDIFF_H
> +#define GIT_XDIFF_H

... here is a good place to spell the expectation out, i.e. that they are expected to change this file to match their system, and that all the things they see below here (including the inclusion of git-compat-util.h) is specific to git-core they are expected to rip out and replace.

Show 14 quoted lines
> +
> +#include "git-compat-util.h"
> +
> +#define xdl_malloc(x) xmalloc(x)
> +#define xdl_free(ptr) free(ptr)
> +#define xdl_realloc(ptr,x) xrealloc(ptr,x)
> +
> +#define xdl_regex_t regex_t
> +#define xdl_regmatch_t regmatch_t
> +#define xdl_regexec_buf(p, b, s, n, m, f) regexec_buf(p, b, s, n, m, f)
> +
> +#define XDL_BUG(msg) BUG(msg)
> +
> +#endif
Thanks.
Previous: Junio C Hamano
Message 8 of 8 in “xdiff: provide indirection to git functions”
  1. 0/1 xdiff: provide indirection to git functionsEdward Thomson, Feb 17, 2022
  2. 1/1 xdiff: provide indirection to git functionsEdward Thomson, Feb 17, 2022
  3. Phillip WoodFeb 22, 2022
  4. Johannes SchindelinFeb 25, 2022
  5. Junio C HamanoFeb 25, 2022
  6. Edward ThomsonFeb 25, 2022
  7. Junio C HamanoFeb 25, 2022
  8. Junio C HamanoFeb 25, 2022

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.