Skip to content

Commit

Permalink
reftable: decouple from Git codebase by pulling in "compat/posix.h"
Browse files Browse the repository at this point in the history
The reftable library includes "git-compat-util.h" in order to get a
POSIX-like programming environment that papers over various differences
between platforms. The header also brings with it a couple of helpers
specific to the Git codebase though, and over time we have started to
use these helpers in the reftable library, as well.

This makes it very hard to use the reftable library as a standalone
library without the rest of the Git codebase, so other libraries like
e.g. libgit2 cannot easily use it. But now that we have removed all
calls to Git-specific functionality and have split out "compat/posix.h"
as a separate header we can address this.

Stop including "git-compat-util.h" and instead include "compat/posix.h"
to finalize the decoupling of the reftable library from the rest of the
Git codebase. The only bits which remain specific to Git are "system.h"
and "system.c", which projects will have to provide.

Signed-off-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
pks-t authored and gitster committed Jan 27, 2025
1 parent bf3da8d commit d6dcf83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions reftable/system.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "../git-compat-util.h"

#include "system.h"
#include "basics.h"
#include "reftable-error.h"
Expand Down
3 changes: 2 additions & 1 deletion reftable/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ license that can be found in the LICENSE file or at

/* This header glues the reftable library to the rest of Git */

#include "git-compat-util.h"
#include "compat/posix.h"
#include <zlib.h>

/*
* Return a random 32 bit integer. This function is expected to return
Expand Down

0 comments on commit d6dcf83

Please sign in to comment.