wrapper.h: move declarations for wrapper.c functions from cache.h

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2023-03-21 06:26:01 +00:00 коммит произвёл Junio C Hamano
Родитель 905f96939b
Коммит d5ebb50dcb
68 изменённых файлов: 103 добавлений и 34 удалений

Просмотреть файл

@ -26,6 +26,7 @@
#include "rerere.h" #include "rerere.h"
#include "apply.h" #include "apply.h"
#include "entry.h" #include "entry.h"
#include "wrapper.h"
struct gitdiff_data { struct gitdiff_data {
struct strbuf *root; struct strbuf *root;

Просмотреть файл

@ -38,6 +38,7 @@
#include "packfile.h" #include "packfile.h"
#include "repository.h" #include "repository.h"
#include "pretty.h" #include "pretty.h"
#include "wrapper.h"
/** /**
* Returns the length of the first line of msg. * Returns the length of the first line of msg.

Просмотреть файл

@ -11,6 +11,7 @@
#include "prompt.h" #include "prompt.h"
#include "quote.h" #include "quote.h"
#include "revision.h" #include "revision.h"
#include "wrapper.h"
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV") static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")

Просмотреть файл

@ -26,6 +26,7 @@
#include "worktree.h" #include "worktree.h"
#include "help.h" #include "help.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "wrapper.h"
static const char * const builtin_branch_usage[] = { static const char * const builtin_branch_usage[] = {
N_("git branch [<options>] [-r | -a] [--merged] [--no-merged]"), N_("git branch [<options>] [-r | -a] [--merged] [--no-merged]"),

Просмотреть файл

@ -8,7 +8,7 @@
#include "hook.h" #include "hook.h"
#include "hook-list.h" #include "hook-list.h"
#include "diagnose.h" #include "diagnose.h"
#include "wrapper.h"
static void get_system_info(struct strbuf *sys_info) static void get_system_info(struct strbuf *sys_info)
{ {

Просмотреть файл

@ -9,6 +9,7 @@
#include "urlmatch.h" #include "urlmatch.h"
#include "quote.h" #include "quote.h"
#include "worktree.h" #include "worktree.h"
#include "wrapper.h"
static const char *const builtin_config_usage[] = { static const char *const builtin_config_usage[] = {
N_("git config [<options>]"), N_("git config [<options>]"),

Просмотреть файл

@ -1,6 +1,7 @@
#include "builtin.h" #include "builtin.h"
#include "gettext.h" #include "gettext.h"
#include "parse-options.h" #include "parse-options.h"
#include "wrapper.h"
#ifndef NO_UNIX_SOCKETS #ifndef NO_UNIX_SOCKETS

Просмотреть файл

@ -27,6 +27,7 @@
#include "object-store.h" #include "object-store.h"
#include "dir.h" #include "dir.h"
#include "entry.h" #include "entry.h"
#include "wrapper.h"
static int trust_exit_code; static int trust_exit_code;

Просмотреть файл

@ -23,6 +23,7 @@
#include "commit-reach.h" #include "commit-reach.h"
#include "khash.h" #include "khash.h"
#include "date.h" #include "date.h"
#include "wrapper.h"
#define PACK_ID_BITS 16 #define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1) #define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)

Просмотреть файл

@ -3,6 +3,7 @@
#include "fmt-merge-msg.h" #include "fmt-merge-msg.h"
#include "gettext.h" #include "gettext.h"
#include "parse-options.h" #include "parse-options.h"
#include "wrapper.h"
static const char * const fmt_merge_msg_usage[] = { static const char * const fmt_merge_msg_usage[] = {
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"), N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),

Просмотреть файл

@ -35,6 +35,7 @@
#include "exec-cmd.h" #include "exec-cmd.h"
#include "gettext.h" #include "gettext.h"
#include "hook.h" #include "hook.h"
#include "wrapper.h"
#define FAILED_RUN "failed to run %s" #define FAILED_RUN "failed to run %s"

Просмотреть файл

@ -6,6 +6,7 @@
#include "tar.h" #include "tar.h"
#include "builtin.h" #include "builtin.h"
#include "quote.h" #include "quote.h"
#include "wrapper.h"
static const char builtin_get_tar_commit_id_usage[] = static const char builtin_get_tar_commit_id_usage[] =
"git get-tar-commit-id"; "git get-tar-commit-id";

Просмотреть файл

@ -19,6 +19,7 @@
#include "object-store.h" #include "object-store.h"
#include "replace-object.h" #include "replace-object.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "wrapper.h"
static const char index_pack_usage[] = 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>])"; "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 "exec-cmd.h"
#include "parse-options.h" #include "parse-options.h"
#include "worktree.h" #include "worktree.h"
#include "wrapper.h"
#ifndef DEFAULT_GIT_TEMPLATE_DIR #ifndef DEFAULT_GIT_TEMPLATE_DIR
#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates" #define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates"

Просмотреть файл

@ -49,6 +49,7 @@
#include "commit-reach.h" #include "commit-reach.h"
#include "wt-status.h" #include "wt-status.h"
#include "commit-graph.h" #include "commit-graph.h"
#include "wrapper.h"
#define DEFAULT_TWOHEAD (1<<0) #define DEFAULT_TWOHEAD (1<<0)
#define DEFAULT_OCTOPUS (1<<1) #define DEFAULT_OCTOPUS (1<<1)

Просмотреть файл

@ -40,6 +40,7 @@
#include "shallow.h" #include "shallow.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "pack-mtimes.h" #include "pack-mtimes.h"
#include "wrapper.h"
/* /*
* Objects we are going to pack are collected in the `to_pack` structure. * Objects we are going to pack are collected in the `to_pack` structure.

Просмотреть файл

@ -32,6 +32,7 @@
#include "rebase-interactive.h" #include "rebase-interactive.h"
#include "reset.h" #include "reset.h"
#include "hook.h" #include "hook.h"
#include "wrapper.h"
static char const * const builtin_rebase_usage[] = { static char const * const builtin_rebase_usage[] = {
N_("git rebase [-i] [options] [--exec <cmd>] " N_("git rebase [-i] [options] [--exec <cmd>] "

Просмотреть файл

@ -33,6 +33,7 @@
#include "commit-reach.h" #include "commit-reach.h"
#include "worktree.h" #include "worktree.h"
#include "shallow.h" #include "shallow.h"
#include "wrapper.h"
static const char * const receive_pack_usage[] = { static const char * const receive_pack_usage[] = {
N_("git receive-pack <git-dir>"), N_("git receive-pack <git-dir>"),

Просмотреть файл

@ -6,6 +6,7 @@
#include "parse-options.h" #include "parse-options.h"
#include "string-list.h" #include "string-list.h"
#include "rerere.h" #include "rerere.h"
#include "wrapper.h"
#include "xdiff/xdiff.h" #include "xdiff/xdiff.h"
#include "xdiff-interface.h" #include "xdiff-interface.h"
#include "pathspec.h" #include "pathspec.h"

Просмотреть файл

@ -2,6 +2,7 @@
#include "config.h" #include "config.h"
#include "hex.h" #include "hex.h"
#include "object-store.h" #include "object-store.h"
#include "wrapper.h"
static char *create_temp_file(struct object_id *oid) static char *create_temp_file(struct object_id *oid)
{ {

Просмотреть файл

@ -16,6 +16,7 @@
#include "submodule.h" #include "submodule.h"
#include "utf8.h" #include "utf8.h"
#include "worktree.h" #include "worktree.h"
#include "wrapper.h"
#include "quote.h" #include "quote.h"
#define BUILTIN_WORKTREE_ADD_USAGE \ #define BUILTIN_WORKTREE_ADD_USAGE \

32
cache.h
Просмотреть файл

@ -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); 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) #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!! * 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); 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 */ /* pager.c */
void setup_pager(void); void setup_pager(void);
int pager_in_use(void); int pager_in_use(void);
@ -1571,7 +1542,4 @@ int versioncmp(const char *s1, const char *s2);
*/ */
int print_sha1_ellipsis(void); 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 */ #endif /* CACHE_H */

Просмотреть файл

@ -22,6 +22,7 @@
#include "json-writer.h" #include "json-writer.h"
#include "trace2.h" #include "trace2.h"
#include "chunk-format.h" #include "chunk-format.h"
#include "wrapper.h"
void git_test_write_commit_graph_or_die(void) void git_test_write_commit_graph_or_die(void)
{ {

Просмотреть файл

@ -11,6 +11,7 @@
#include "../alloc.h" #include "../alloc.h"
#include "win32/lazyload.h" #include "win32/lazyload.h"
#include "../config.h" #include "../config.h"
#include "../wrapper.h"
#include "dir.h" #include "dir.h"
#include "gettext.h" #include "gettext.h"
#define SECURITY_WIN32 #define SECURITY_WIN32

Просмотреть файл

@ -6,6 +6,7 @@
#include "run-command.h" #include "run-command.h"
#include "string-list.h" #include "string-list.h"
#include "hashmap.h" #include "hashmap.h"
#include "wrapper.h"
#if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE) #if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)

Просмотреть файл

@ -28,6 +28,7 @@
#include "replace-object.h" #include "replace-object.h"
#include "refs.h" #include "refs.h"
#include "worktree.h" #include "worktree.h"
#include "wrapper.h"
struct config_source { struct config_source {
struct config_source *prev; struct config_source *prev;

Просмотреть файл

@ -11,6 +11,7 @@
#include "sub-process.h" #include "sub-process.h"
#include "utf8.h" #include "utf8.h"
#include "ll-merge.h" #include "ll-merge.h"
#include "wrapper.h"
/* /*
* convert.c - convert a file when checking it out and checking it in. * convert.c - convert a file when checking it out and checking it in.

1
copy.c
Просмотреть файл

@ -1,4 +1,5 @@
#include "cache.h" #include "cache.h"
#include "wrapper.h"
int copy_fd(int ifd, int ofd) int copy_fd(int ifd, int ofd)
{ {

Просмотреть файл

@ -10,6 +10,7 @@
#include "cache.h" #include "cache.h"
#include "progress.h" #include "progress.h"
#include "csum-file.h" #include "csum-file.h"
#include "wrapper.h"
static void verify_buffer_or_die(struct hashfile *f, static void verify_buffer_or_die(struct hashfile *f,
const void *buf, const void *buf,

Просмотреть файл

@ -6,6 +6,7 @@
#include "run-command.h" #include "run-command.h"
#include "strbuf.h" #include "strbuf.h"
#include "string-list.h" #include "string-list.h"
#include "wrapper.h"
#ifdef NO_INITGROUPS #ifdef NO_INITGROUPS
#define initgroups(x, y) (0) /* nothing */ #define initgroups(x, y) (0) /* nothing */

1
diff.c
Просмотреть файл

@ -33,6 +33,7 @@
#include "promisor-remote.h" #include "promisor-remote.h"
#include "dir.h" #include "dir.h"
#include "strmap.h" #include "strmap.h"
#include "wrapper.h"
#ifdef NO_FAST_WORKING_DIRECTORY #ifdef NO_FAST_WORKING_DIRECTORY
#define FAST_WORKING_DIRECTORY 0 #define FAST_WORKING_DIRECTORY 0

1
dir.c
Просмотреть файл

@ -21,6 +21,7 @@
#include "ewah/ewok.h" #include "ewah/ewok.h"
#include "fsmonitor.h" #include "fsmonitor.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "wrapper.h"
/* /*
* Tells read_directory_recursive how a file or directory should be treated. * Tells read_directory_recursive how a file or directory should be treated.

Просмотреть файл

@ -10,6 +10,7 @@
#include "fsmonitor.h" #include "fsmonitor.h"
#include "entry.h" #include "entry.h"
#include "parallel-checkout.h" #include "parallel-checkout.h"
#include "wrapper.h"
static void create_directories(const char *path, int path_len, static void create_directories(const char *path, int path_len,
const struct checkout *state) const struct checkout *state)

Просмотреть файл

@ -23,6 +23,7 @@
#include "tmp-objdir.h" #include "tmp-objdir.h"
#include "chdir-notify.h" #include "chdir-notify.h"
#include "shallow.h" #include "shallow.h"
#include "wrapper.h"
int trust_executable_bit = 1; int trust_executable_bit = 1;
int trust_ctime = 1; int trust_ctime = 1;

Просмотреть файл

@ -30,6 +30,7 @@
#include "commit-graph.h" #include "commit-graph.h"
#include "sigchain.h" #include "sigchain.h"
#include "mergesort.h" #include "mergesort.h"
#include "wrapper.h"
static int transfer_unpack_limit = -1; static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1; static int fetch_unpack_limit = -1;

Просмотреть файл

@ -10,6 +10,7 @@
#include "sigchain.h" #include "sigchain.h"
#include "tempfile.h" #include "tempfile.h"
#include "alias.h" #include "alias.h"
#include "wrapper.h"
static int git_gpg_config(const char *, const char *, void *); static int git_gpg_config(const char *, const char *, void *);

Просмотреть файл

@ -16,6 +16,7 @@
#include "object-store.h" #include "object-store.h"
#include "protocol.h" #include "protocol.h"
#include "date.h" #include "date.h"
#include "wrapper.h"
static const char content_type[] = "Content-Type"; static const char content_type[] = "Content-Type";
static const char content_length[] = "Content-Length"; static const char content_length[] = "Content-Length";

Просмотреть файл

@ -28,6 +28,7 @@
#include "gettext.h" #include "gettext.h"
#include "run-command.h" #include "run-command.h"
#include "parse-options.h" #include "parse-options.h"
#include "wrapper.h"
#if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG) #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)
typedef void *SSL; typedef void *SSL;
#endif #endif

Просмотреть файл

@ -11,6 +11,7 @@
#include "run-command.h" #include "run-command.h"
#include "ll-merge.h" #include "ll-merge.h"
#include "quote.h" #include "quote.h"
#include "wrapper.h"
struct ll_merge_driver; struct ll_merge_driver;

Просмотреть файл

@ -30,6 +30,7 @@
#include "tag.h" #include "tag.h"
#include "tree-walk.h" #include "tree-walk.h"
#include "unpack-trees.h" #include "unpack-trees.h"
#include "wrapper.h"
#include "xdiff-interface.h" #include "xdiff-interface.h"
struct merge_options_internal { struct merge_options_internal {

Просмотреть файл

@ -15,6 +15,7 @@
#include "strbuf.h" #include "strbuf.h"
#include "notes-utils.h" #include "notes-utils.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "wrapper.h"
struct notes_merge_pair { struct notes_merge_pair {
struct object_id obj, base, local, remote; struct object_id obj, base, local, remote;

Просмотреть файл

@ -38,6 +38,7 @@
#include "promisor-remote.h" #include "promisor-remote.h"
#include "submodule.h" #include "submodule.h"
#include "fsck.h" #include "fsck.h"
#include "wrapper.h"
/* The maximum size for an object header. */ /* The maximum size for an object header. */
#define MAX_HEADER_LEN 32 #define MAX_HEADER_LEN 32

Просмотреть файл

@ -20,6 +20,7 @@
#include "midx.h" #include "midx.h"
#include "commit-graph.h" #include "commit-graph.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "wrapper.h"
char *odb_pack_name(struct strbuf *buf, char *odb_pack_name(struct strbuf *buf,
const unsigned char *hash, const unsigned char *hash,

Просмотреть файл

@ -12,6 +12,7 @@
#include "streaming.h" #include "streaming.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "trace2.h" #include "trace2.h"
#include "wrapper.h"
struct pc_worker { struct pc_worker {
struct child_process cp; struct child_process cp;

Просмотреть файл

@ -3,6 +3,7 @@
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "run-command.h" #include "run-command.h"
#include "wrapper.h"
char packet_buffer[LARGE_PACKET_MAX]; char packet_buffer[LARGE_PACKET_MAX];
static const char *packet_trace_prefix = "git"; static const char *packet_trace_prefix = "git";

Просмотреть файл

@ -32,6 +32,7 @@
#include "csum-file.h" #include "csum-file.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "hook.h" #include "hook.h"
#include "wrapper.h"
/* Mask for the name length in ce_flags in the on-disk index */ /* Mask for the name length in ce_flags in the on-disk index */

Просмотреть файл

@ -7,6 +7,7 @@
#include "commit-slab.h" #include "commit-slab.h"
#include "config.h" #include "config.h"
#include "dir.h" #include "dir.h"
#include "wrapper.h"
static const char edit_todo_list_advice[] = static const char edit_todo_list_advice[] =
N_("You can fix this with 'git rebase --edit-todo' " N_("You can fix this with 'git rebase --edit-todo' "

1
refs.c
Просмотреть файл

@ -24,6 +24,7 @@
#include "sigchain.h" #include "sigchain.h"
#include "date.h" #include "date.h"
#include "commit.h" #include "commit.h"
#include "wrapper.h"
/* /*
* List of all available backends * List of all available backends

Просмотреть файл

@ -13,7 +13,8 @@
#include "../object.h" #include "../object.h"
#include "../dir.h" #include "../dir.h"
#include "../chdir-notify.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 * This backend uses the following flags in `ref_update::flags` for

Просмотреть файл

@ -16,6 +16,7 @@
#include "object-store.h" #include "object-store.h"
#include "hash-lookup.h" #include "hash-lookup.h"
#include "strmap.h" #include "strmap.h"
#include "wrapper.h"
#define RESOLVED 0 #define RESOLVED 0
#define PUNTED 1 #define PUNTED 1

Просмотреть файл

@ -41,6 +41,7 @@
#include "rebase-interactive.h" #include "rebase-interactive.h"
#include "reset.h" #include "reset.h"
#include "branch.h" #include "branch.h"
#include "wrapper.h"
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION" #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"

Просмотреть файл

@ -10,6 +10,7 @@
#include "packfile.h" #include "packfile.h"
#include "object-store.h" #include "object-store.h"
#include "strbuf.h" #include "strbuf.h"
#include "wrapper.h"
struct update_info_ctx { struct update_info_ctx {
FILE *cur_fp; FILE *cur_fp;

Просмотреть файл

@ -17,6 +17,7 @@
#include "list-objects.h" #include "list-objects.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "shallow.h" #include "shallow.h"
#include "wrapper.h"
void set_alternate_shallow_file(struct repository *r, const char *path, int override) void set_alternate_shallow_file(struct repository *r, const char *path, int override)
{ {

Просмотреть файл

@ -8,6 +8,7 @@
#include "string-list.h" #include "string-list.h"
#include "utf8.h" #include "utf8.h"
#include "date.h" #include "date.h"
#include "wrapper.h"
int starts_with(const char *str, const char *prefix) int starts_with(const char *str, const char *prefix)
{ {

Просмотреть файл

@ -7,6 +7,7 @@
#include "object-store.h" #include "object-store.h"
#include "replace-object.h" #include "replace-object.h"
#include "packfile.h" #include "packfile.h"
#include "wrapper.h"
typedef int (*open_istream_fn)(struct git_istream *, typedef int (*open_istream_fn)(struct git_istream *,
struct repository *, struct repository *,

Просмотреть файл

@ -12,6 +12,7 @@
#include "git-compat-util.h" #include "git-compat-util.h"
#include "delta.h" #include "delta.h"
#include "cache.h" #include "cache.h"
#include "wrapper.h"
static const char usage_str[] = static const char usage_str[] =
"test-tool delta (-d|-p) <from_file> <data_file> <out_file>"; "test-tool delta (-d|-p) <from_file> <data_file> <out_file>";

Просмотреть файл

@ -9,6 +9,7 @@
#include "fsmonitor-ipc.h" #include "fsmonitor-ipc.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "trace2.h" #include "trace2.h"
#include "wrapper.h"
#ifndef HAVE_FSMONITOR_DAEMON_BACKEND #ifndef HAVE_FSMONITOR_DAEMON_BACKEND
int cmd__fsmonitor_client(int argc, const char **argv) int cmd__fsmonitor_client(int argc, const char **argv)

Просмотреть файл

@ -2,6 +2,7 @@
#include "test-tool.h" #include "test-tool.h"
#include "cache.h" #include "cache.h"
#include "config.h" #include "config.h"
#include "wrapper.h"
int cmd__read_cache(int argc, const char **argv) int cmd__read_cache(int argc, const char **argv)
{ {

1
tag.c
Просмотреть файл

@ -8,6 +8,7 @@
#include "gpg-interface.h" #include "gpg-interface.h"
#include "hex.h" #include "hex.h"
#include "packfile.h" #include "packfile.h"
#include "wrapper.h"
const char *tag_type = "tag"; const char *tag_type = "tag";

Просмотреть файл

@ -45,6 +45,7 @@
#include "cache.h" #include "cache.h"
#include "tempfile.h" #include "tempfile.h"
#include "sigchain.h" #include "sigchain.h"
#include "wrapper.h"
static VOLATILE_LIST_HEAD(tempfile_list); static VOLATILE_LIST_HEAD(tempfile_list);

Просмотреть файл

@ -24,6 +24,7 @@
#include "cache.h" #include "cache.h"
#include "abspath.h" #include "abspath.h"
#include "quote.h" #include "quote.h"
#include "wrapper.h"
struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 }; struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 };
struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE); struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);

Просмотреть файл

@ -16,6 +16,7 @@
#include "refspec.h" #include "refspec.h"
#include "transport-internal.h" #include "transport-internal.h"
#include "protocol.h" #include "protocol.h"
#include "wrapper.h"
static int debug; static int debug;

Просмотреть файл

@ -26,6 +26,7 @@
#include "object-store.h" #include "object-store.h"
#include "color.h" #include "color.h"
#include "bundle-uri.h" #include "bundle-uri.h"
#include "wrapper.h"
static int transport_use_color = -1; static int transport_use_color = -1;
static char transport_colors[][COLOR_MAXLEN] = { static char transport_colors[][COLOR_MAXLEN] = {

Просмотреть файл

@ -5,6 +5,7 @@
*/ */
#include "cache.h" #include "cache.h"
#include "gettext.h" #include "gettext.h"
#include "wrapper.h"
static void vreportf(const char *prefix, const char *err, va_list params) static void vreportf(const char *prefix, const char *err, va_list params)
{ {

Просмотреть файл

@ -9,6 +9,7 @@
#include "dir.h" #include "dir.h"
#include "wt-status.h" #include "wt-status.h"
#include "config.h" #include "config.h"
#include "wrapper.h"
void free_worktrees(struct worktree **worktrees) void free_worktrees(struct worktree **worktrees)
{ {

Просмотреть файл

@ -5,6 +5,7 @@
#include "abspath.h" #include "abspath.h"
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "wrapper.h"
static intmax_t count_fsync_writeout_only; static intmax_t count_fsync_writeout_only;
static intmax_t count_fsync_hardware_flush; static intmax_t count_fsync_hardware_flush;

36
wrapper.h Normal file
Просмотреть файл

@ -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 "cache.h"
#include "config.h" #include "config.h"
#include "run-command.h" #include "run-command.h"
#include "wrapper.h"
/* /*
* Some cases use stdio, but want to flush after the write * Some cases use stdio, but want to flush after the write