@@ -26,6 +26,7 @@
#include "rerere.h"
#include "apply.h"
#include "entry.h"
+#include "wrapper.h"
struct gitdiff_data {
struct strbuf *root;
@@ -38,6 +38,7 @@
#include "packfile.h"
#include "repository.h"
#include "pretty.h"
+#include "wrapper.h"
/**
* Returns the length of the first line of msg.
@@ -11,6 +11,7 @@
#include "prompt.h"
#include "quote.h"
#include "revision.h"
+#include "wrapper.h"
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
@@ -26,6 +26,7 @@
#include "worktree.h"
#include "help.h"
#include "commit-reach.h"
+#include "wrapper.h"
static const char * const builtin_branch_usage[] = {
N_("git branch [<options>] [-r | -a] [--merged] [--no-merged]"),
@@ -8,7 +8,7 @@
#include "hook.h"
#include "hook-list.h"
#include "diagnose.h"
-
+#include "wrapper.h"
static void get_system_info(struct strbuf *sys_info)
{
@@ -9,6 +9,7 @@
#include "urlmatch.h"
#include "quote.h"
#include "worktree.h"
+#include "wrapper.h"
static const char *const builtin_config_usage[] = {
N_("git config [<options>]"),
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "gettext.h"
#include "parse-options.h"
+#include "wrapper.h"
#ifndef NO_UNIX_SOCKETS
@@ -27,6 +27,7 @@
#include "object-store.h"
#include "dir.h"
#include "entry.h"
+#include "wrapper.h"
static int trust_exit_code;
@@ -23,6 +23,7 @@
#include "commit-reach.h"
#include "khash.h"
#include "date.h"
+#include "wrapper.h"
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -3,6 +3,7 @@
#include "fmt-merge-msg.h"
#include "gettext.h"
#include "parse-options.h"
+#include "wrapper.h"
static const char * const fmt_merge_msg_usage[] = {
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),
@@ -35,6 +35,7 @@
#include "exec-cmd.h"
#include "gettext.h"
#include "hook.h"
+#include "wrapper.h"
#define FAILED_RUN "failed to run %s"
@@ -6,6 +6,7 @@
#include "tar.h"
#include "builtin.h"
#include "quote.h"
+#include "wrapper.h"
static const char builtin_get_tar_commit_id_usage[] =
"git get-tar-commit-id";
@@ -19,6 +19,7 @@
#include "object-store.h"
#include "replace-object.h"
#include "promisor-remote.h"
+#include "wrapper.h"
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
@@ -12,6 +12,7 @@
#include "exec-cmd.h"
#include "parse-options.h"
#include "worktree.h"
+#include "wrapper.h"
#ifndef DEFAULT_GIT_TEMPLATE_DIR
#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates"
@@ -49,6 +49,7 @@
#include "commit-reach.h"
#include "wt-status.h"
#include "commit-graph.h"
+#include "wrapper.h"
#define DEFAULT_TWOHEAD (1<<0)
#define DEFAULT_OCTOPUS (1<<1)
@@ -40,6 +40,7 @@
#include "shallow.h"
#include "promisor-remote.h"
#include "pack-mtimes.h"
+#include "wrapper.h"
/*
* Objects we are going to pack are collected in the `to_pack` structure.
@@ -32,6 +32,7 @@
#include "rebase-interactive.h"
#include "reset.h"
#include "hook.h"
+#include "wrapper.h"
static char const * const builtin_rebase_usage[] = {
N_("git rebase [-i] [options] [--exec <cmd>] "
@@ -33,6 +33,7 @@
#include "commit-reach.h"
#include "worktree.h"
#include "shallow.h"
+#include "wrapper.h"
static const char * const receive_pack_usage[] = {
N_("git receive-pack <git-dir>"),
@@ -6,6 +6,7 @@
#include "parse-options.h"
#include "string-list.h"
#include "rerere.h"
+#include "wrapper.h"
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"
#include "pathspec.h"
@@ -2,6 +2,7 @@
#include "config.h"
#include "hex.h"
#include "object-store.h"
+#include "wrapper.h"
static char *create_temp_file(struct object_id *oid)
{
@@ -16,6 +16,7 @@
#include "submodule.h"
#include "utf8.h"
#include "worktree.h"
+#include "wrapper.h"
#include "quote.h"
#define BUILTIN_WORKTREE_ADD_USAGE \
@@ -1085,10 +1085,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id
int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);
#define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)
-/* set default permissions by passing mode arguments to open(2) */
-int git_mkstemps_mode(char *pattern, int suffix_len, int mode);
-int git_mkstemp_mode(char *pattern, int mode);
-
/*
* NOTE NOTE NOTE!!
*
@@ -1423,31 +1419,6 @@ static inline int batch_fsync_enabled(enum fsync_component component)
return (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);
}
-ssize_t read_in_full(int fd, void *buf, size_t count);
-ssize_t write_in_full(int fd, const void *buf, size_t count);
-ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
-
-static inline ssize_t write_str_in_full(int fd, const char *str)
-{
- return write_in_full(fd, str, strlen(str));
-}
-
-/**
- * Open (and truncate) the file at path, write the contents of buf to it,
- * and close it. Dies if any errors are encountered.
- */
-void write_file_buf(const char *path, const char *buf, size_t len);
-
-/**
- * Like write_file_buf(), but format the contents into a buffer first.
- * Additionally, write_file() will append a newline if one is not already
- * present, making it convenient to write text files:
- *
- * write_file(path, "counter: %d", ctr);
- */
-__attribute__((format (printf, 2, 3)))
-void write_file(const char *path, const char *fmt, ...);
-
/* pager.c */
void setup_pager(void);
int pager_in_use(void);
@@ -1571,7 +1542,4 @@ int versioncmp(const char *s1, const char *s2);
*/
int print_sha1_ellipsis(void);
-/* Return 1 if the file is empty or does not exists, 0 otherwise. */
-int is_empty_or_missing_file(const char *filename);
-
#endif /* CACHE_H */
@@ -22,6 +22,7 @@
#include "json-writer.h"
#include "trace2.h"
#include "chunk-format.h"
+#include "wrapper.h"
void git_test_write_commit_graph_or_die(void)
{
@@ -11,6 +11,7 @@
#include "../alloc.h"
#include "win32/lazyload.h"
#include "../config.h"
+#include "../wrapper.h"
#include "dir.h"
#include "gettext.h"
#define SECURITY_WIN32
@@ -6,6 +6,7 @@
#include "run-command.h"
#include "string-list.h"
#include "hashmap.h"
+#include "wrapper.h"
#if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)
@@ -28,6 +28,7 @@
#include "replace-object.h"
#include "refs.h"
#include "worktree.h"
+#include "wrapper.h"
struct config_source {
struct config_source *prev;
@@ -11,6 +11,7 @@
#include "sub-process.h"
#include "utf8.h"
#include "ll-merge.h"
+#include "wrapper.h"
/*
* convert.c - convert a file when checking it out and checking it in.
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "wrapper.h"
int copy_fd(int ifd, int ofd)
{
@@ -10,6 +10,7 @@
#include "cache.h"
#include "progress.h"
#include "csum-file.h"
+#include "wrapper.h"
static void verify_buffer_or_die(struct hashfile *f,
const void *buf,
@@ -6,6 +6,7 @@
#include "run-command.h"
#include "strbuf.h"
#include "string-list.h"
+#include "wrapper.h"
#ifdef NO_INITGROUPS
#define initgroups(x, y) (0) /* nothing */
@@ -33,6 +33,7 @@
#include "promisor-remote.h"
#include "dir.h"
#include "strmap.h"
+#include "wrapper.h"
#ifdef NO_FAST_WORKING_DIRECTORY
#define FAST_WORKING_DIRECTORY 0
@@ -21,6 +21,7 @@
#include "ewah/ewok.h"
#include "fsmonitor.h"
#include "submodule-config.h"
+#include "wrapper.h"
/*
* Tells read_directory_recursive how a file or directory should be treated.
@@ -10,6 +10,7 @@
#include "fsmonitor.h"
#include "entry.h"
#include "parallel-checkout.h"
+#include "wrapper.h"
static void create_directories(const char *path, int path_len,
const struct checkout *state)
@@ -23,6 +23,7 @@
#include "tmp-objdir.h"
#include "chdir-notify.h"
#include "shallow.h"
+#include "wrapper.h"
int trust_executable_bit = 1;
int trust_ctime = 1;
@@ -30,6 +30,7 @@
#include "commit-graph.h"
#include "sigchain.h"
#include "mergesort.h"
+#include "wrapper.h"
static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1;
@@ -10,6 +10,7 @@
#include "sigchain.h"
#include "tempfile.h"
#include "alias.h"
+#include "wrapper.h"
static int git_gpg_config(const char *, const char *, void *);
@@ -16,6 +16,7 @@
#include "object-store.h"
#include "protocol.h"
#include "date.h"
+#include "wrapper.h"
static const char content_type[] = "Content-Type";
static const char content_length[] = "Content-Length";
@@ -28,6 +28,7 @@
#include "gettext.h"
#include "run-command.h"
#include "parse-options.h"
+#include "wrapper.h"
#if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)
typedef void *SSL;
#endif
@@ -11,6 +11,7 @@
#include "run-command.h"
#include "ll-merge.h"
#include "quote.h"
+#include "wrapper.h"
struct ll_merge_driver;
@@ -30,6 +30,7 @@
#include "tag.h"
#include "tree-walk.h"
#include "unpack-trees.h"
+#include "wrapper.h"
#include "xdiff-interface.h"
struct merge_options_internal {
@@ -15,6 +15,7 @@
#include "strbuf.h"
#include "notes-utils.h"
#include "commit-reach.h"
+#include "wrapper.h"
struct notes_merge_pair {
struct object_id obj, base, local, remote;
@@ -38,6 +38,7 @@
#include "promisor-remote.h"
#include "submodule.h"
#include "fsck.h"
+#include "wrapper.h"
/* The maximum size for an object header. */
#define MAX_HEADER_LEN 32
@@ -20,6 +20,7 @@
#include "midx.h"
#include "commit-graph.h"
#include "promisor-remote.h"
+#include "wrapper.h"
char *odb_pack_name(struct strbuf *buf,
const unsigned char *hash,
@@ -12,6 +12,7 @@
#include "streaming.h"
#include "thread-utils.h"
#include "trace2.h"
+#include "wrapper.h"
struct pc_worker {
struct child_process cp;
@@ -3,6 +3,7 @@
#include "gettext.h"
#include "hex.h"
#include "run-command.h"
+#include "wrapper.h"
char packet_buffer[LARGE_PACKET_MAX];
static const char *packet_trace_prefix = "git";
@@ -32,6 +32,7 @@
#include "csum-file.h"
#include "promisor-remote.h"
#include "hook.h"
+#include "wrapper.h"
/* Mask for the name length in ce_flags in the on-disk index */
@@ -7,6 +7,7 @@
#include "commit-slab.h"
#include "config.h"
#include "dir.h"
+#include "wrapper.h"
static const char edit_todo_list_advice[] =
N_("You can fix this with 'git rebase --edit-todo' "
@@ -24,6 +24,7 @@
#include "sigchain.h"
#include "date.h"
#include "commit.h"
+#include "wrapper.h"
/*
* List of all available backends
@@ -13,7 +13,8 @@
#include "../object.h"
#include "../dir.h"
#include "../chdir-notify.h"
-#include "worktree.h"
+#include "../worktree.h"
+#include "../wrapper.h"
/*
* This backend uses the following flags in `ref_update::flags` for
@@ -16,6 +16,7 @@
#include "object-store.h"
#include "hash-lookup.h"
#include "strmap.h"
+#include "wrapper.h"
#define RESOLVED 0
#define PUNTED 1
@@ -41,6 +41,7 @@
#include "rebase-interactive.h"
#include "reset.h"
#include "branch.h"
+#include "wrapper.h"
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
@@ -10,6 +10,7 @@
#include "packfile.h"
#include "object-store.h"
#include "strbuf.h"
+#include "wrapper.h"
struct update_info_ctx {
FILE *cur_fp;
@@ -17,6 +17,7 @@
#include "list-objects.h"
#include "commit-reach.h"
#include "shallow.h"
+#include "wrapper.h"
void set_alternate_shallow_file(struct repository *r, const char *path, int override)
{
@@ -8,6 +8,7 @@
#include "string-list.h"
#include "utf8.h"
#include "date.h"
+#include "wrapper.h"
int starts_with(const char *str, const char *prefix)
{
@@ -7,6 +7,7 @@
#include "object-store.h"
#include "replace-object.h"
#include "packfile.h"
+#include "wrapper.h"
typedef int (*open_istream_fn)(struct git_istream *,
struct repository *,
@@ -12,6 +12,7 @@
#include "git-compat-util.h"
#include "delta.h"
#include "cache.h"
+#include "wrapper.h"
static const char usage_str[] =
"test-tool delta (-d|-p) <from_file> <data_file> <out_file>";
@@ -9,6 +9,7 @@
#include "fsmonitor-ipc.h"
#include "thread-utils.h"
#include "trace2.h"
+#include "wrapper.h"
#ifndef HAVE_FSMONITOR_DAEMON_BACKEND
int cmd__fsmonitor_client(int argc, const char **argv)
@@ -2,6 +2,7 @@
#include "test-tool.h"
#include "cache.h"
#include "config.h"
+#include "wrapper.h"
int cmd__read_cache(int argc, const char **argv)
{
@@ -8,6 +8,7 @@
#include "gpg-interface.h"
#include "hex.h"
#include "packfile.h"
+#include "wrapper.h"
const char *tag_type = "tag";
@@ -45,6 +45,7 @@
#include "cache.h"
#include "tempfile.h"
#include "sigchain.h"
+#include "wrapper.h"
static VOLATILE_LIST_HEAD(tempfile_list);
@@ -24,6 +24,7 @@
#include "cache.h"
#include "abspath.h"
#include "quote.h"
+#include "wrapper.h"
struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 };
struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);
@@ -16,6 +16,7 @@
#include "refspec.h"
#include "transport-internal.h"
#include "protocol.h"
+#include "wrapper.h"
static int debug;
@@ -26,6 +26,7 @@
#include "object-store.h"
#include "color.h"
#include "bundle-uri.h"
+#include "wrapper.h"
static int transport_use_color = -1;
static char transport_colors[][COLOR_MAXLEN] = {
@@ -5,6 +5,7 @@
*/
#include "cache.h"
#include "gettext.h"
+#include "wrapper.h"
static void vreportf(const char *prefix, const char *err, va_list params)
{
@@ -9,6 +9,7 @@
#include "dir.h"
#include "wt-status.h"
#include "config.h"
+#include "wrapper.h"
void free_worktrees(struct worktree **worktrees)
{
@@ -5,6 +5,7 @@
#include "abspath.h"
#include "config.h"
#include "gettext.h"
+#include "wrapper.h"
static intmax_t count_fsync_writeout_only;
static intmax_t count_fsync_hardware_flush;
new file mode 100644
@@ -0,0 +1,36 @@
+#ifndef WRAPPER_H
+#define WRAPPER_H
+
+/* set default permissions by passing mode arguments to open(2) */
+int git_mkstemps_mode(char *pattern, int suffix_len, int mode);
+int git_mkstemp_mode(char *pattern, int mode);
+
+ssize_t read_in_full(int fd, void *buf, size_t count);
+ssize_t write_in_full(int fd, const void *buf, size_t count);
+ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
+
+static inline ssize_t write_str_in_full(int fd, const char *str)
+{
+ return write_in_full(fd, str, strlen(str));
+}
+
+/**
+ * Open (and truncate) the file at path, write the contents of buf to it,
+ * and close it. Dies if any errors are encountered.
+ */
+void write_file_buf(const char *path, const char *buf, size_t len);
+
+/**
+ * Like write_file_buf(), but format the contents into a buffer first.
+ * Additionally, write_file() will append a newline if one is not already
+ * present, making it convenient to write text files:
+ *
+ * write_file(path, "counter: %d", ctr);
+ */
+__attribute__((format (printf, 2, 3)))
+void write_file(const char *path, const char *fmt, ...);
+
+/* Return 1 if the file is empty or does not exists, 0 otherwise. */
+int is_empty_or_missing_file(const char *filename);
+
+#endif /* WRAPPER_H */
@@ -1,6 +1,7 @@
#include "cache.h"
#include "config.h"
#include "run-command.h"
+#include "wrapper.h"
/*
* Some cases use stdio, but want to flush after the write