Skip to content

Commit d48be35

Browse files
newrengitster
authored andcommitted
write-or-die.h: move declarations for write-or-die.c functions from cache.h
Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 61a7b98 commit d48be35

35 files changed

+114
-77
lines changed

archive-tar.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "object-store.h"
1212
#include "streaming.h"
1313
#include "run-command.h"
14+
#include "write-or-die.h"
1415

1516
#define RECORDSIZE (512)
1617
#define BLOCKSIZE (RECORDSIZE * 20)

archive-zip.c

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "utf8.h"
1111
#include "object-store.h"
1212
#include "userdiff.h"
13+
#include "write-or-die.h"
1314
#include "xdiff-interface.h"
1415
#include "date.h"
1516

builtin/blame.c

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "refs.h"
3434
#include "setup.h"
3535
#include "tag.h"
36+
#include "write-or-die.h"
3637

3738
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
3839
static char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");

builtin/cat-file.c

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "replace-object.h"
2424
#include "promisor-remote.h"
2525
#include "mailmap.h"
26+
#include "write-or-die.h"
2627

2728
enum batch_mode {
2829
BATCH_MODE_CONTENTS,

builtin/check-attr.c

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "quote.h"
99
#include "setup.h"
1010
#include "parse-options.h"
11+
#include "write-or-die.h"
1112

1213
static int all_attrs;
1314
static int cached_attrs;

builtin/check-ignore.c

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "pathspec.h"
99
#include "parse-options.h"
1010
#include "submodule.h"
11+
#include "write-or-die.h"
1112

1213
static int quiet, verbose, stdin_paths, show_non_matching, no_index;
1314
static const char * const check_ignore_usage[] = {

builtin/check-mailmap.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "mailmap.h"
66
#include "parse-options.h"
77
#include "string-list.h"
8+
#include "write-or-die.h"
89

910
static int use_stdin;
1011
static const char * const check_mailmap_usage[] = {

builtin/credential-cache.c

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "gettext.h"
33
#include "parse-options.h"
44
#include "wrapper.h"
5+
#include "write-or-die.h"
56

67
#ifndef NO_UNIX_SOCKETS
78

builtin/credential-store.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "credential.h"
66
#include "string-list.h"
77
#include "parse-options.h"
8+
#include "write-or-die.h"
89

910
static struct lock_file credential_lock;
1011

builtin/grep.c

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "submodule-config.h"
2929
#include "object-store.h"
3030
#include "packfile.h"
31+
#include "write-or-die.h"
3132

3233
static const char *grep_prefix;
3334

builtin/hash-object.c

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "parse-options.h"
1616
#include "exec-cmd.h"
1717
#include "setup.h"
18+
#include "write-or-die.h"
1819

1920
/*
2021
* This is to create corrupt objects for debugging and as such it

builtin/log.c

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "commit-reach.h"
4141
#include "range-diff.h"
4242
#include "tmp-objdir.h"
43+
#include "write-or-die.h"
4344

4445
#define MAIL_DEFAULT_WRAP 72
4546
#define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100

builtin/notes.c

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "notes-merge.h"
2626
#include "notes-utils.h"
2727
#include "worktree.h"
28+
#include "write-or-die.h"
2829

2930
static const char * const git_notes_usage[] = {
3031
N_("git notes [--ref <notes-ref>] [list [<object>]]"),

builtin/send-pack.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "gpg-interface.h"
1717
#include "gettext.h"
1818
#include "protocol.h"
19+
#include "write-or-die.h"
1920

2021
static const char * const send_pack_usage[] = {
2122
N_("git send-pack [--mirror] [--dry-run] [--force]\n"

builtin/stripspace.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "parse-options.h"
66
#include "setup.h"
77
#include "strbuf.h"
8+
#include "write-or-die.h"
89

910
static void comment_lines(struct strbuf *buf)
1011
{

builtin/tag.c

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "column.h"
2525
#include "ref-filter.h"
2626
#include "date.h"
27+
#include "write-or-die.h"
2728

2829
static const char * const git_tag_usage[] = {
2930
N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"

builtin/update-index.c

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "setup.h"
2424
#include "split-index.h"
2525
#include "fsmonitor.h"
26+
#include "write-or-die.h"
2627

2728
/*
2829
* Default to not allowing changes to the list of files. The

bundle.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "strvec.h"
1717
#include "list-objects-filter-options.h"
1818
#include "connected.h"
19+
#include "write-or-die.h"
1920

2021
static const char v2_bundle_signature[] = "# v2 git bundle\n";
2122
static const char v3_bundle_signature[] = "# v3 git bundle\n";

cache.h

-74
Original file line numberDiff line numberDiff line change
@@ -686,63 +686,6 @@ extern int verify_ce_order;
686686

687687
extern int quote_path_fully;
688688

689-
/*
690-
* These values are used to help identify parts of a repository to fsync.
691-
* FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the
692-
* repository and so shouldn't be fsynced.
693-
*/
694-
enum fsync_component {
695-
FSYNC_COMPONENT_NONE,
696-
FSYNC_COMPONENT_LOOSE_OBJECT = 1 << 0,
697-
FSYNC_COMPONENT_PACK = 1 << 1,
698-
FSYNC_COMPONENT_PACK_METADATA = 1 << 2,
699-
FSYNC_COMPONENT_COMMIT_GRAPH = 1 << 3,
700-
FSYNC_COMPONENT_INDEX = 1 << 4,
701-
FSYNC_COMPONENT_REFERENCE = 1 << 5,
702-
};
703-
704-
#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \
705-
FSYNC_COMPONENT_PACK)
706-
707-
#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \
708-
FSYNC_COMPONENT_COMMIT_GRAPH)
709-
710-
#define FSYNC_COMPONENTS_DEFAULT ((FSYNC_COMPONENTS_OBJECTS | \
711-
FSYNC_COMPONENTS_DERIVED_METADATA) & \
712-
~FSYNC_COMPONENT_LOOSE_OBJECT)
713-
714-
#define FSYNC_COMPONENTS_COMMITTED (FSYNC_COMPONENTS_OBJECTS | \
715-
FSYNC_COMPONENT_REFERENCE)
716-
717-
#define FSYNC_COMPONENTS_ADDED (FSYNC_COMPONENTS_COMMITTED | \
718-
FSYNC_COMPONENT_INDEX)
719-
720-
#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \
721-
FSYNC_COMPONENT_PACK | \
722-
FSYNC_COMPONENT_PACK_METADATA | \
723-
FSYNC_COMPONENT_COMMIT_GRAPH | \
724-
FSYNC_COMPONENT_INDEX | \
725-
FSYNC_COMPONENT_REFERENCE)
726-
727-
#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT
728-
#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT
729-
#endif
730-
731-
/*
732-
* A bitmask indicating which components of the repo should be fsynced.
733-
*/
734-
extern enum fsync_component fsync_components;
735-
extern int fsync_object_files;
736-
extern int use_fsync;
737-
738-
enum fsync_method {
739-
FSYNC_METHOD_FSYNC,
740-
FSYNC_METHOD_WRITEOUT_ONLY,
741-
FSYNC_METHOD_BATCH,
742-
};
743-
744-
extern enum fsync_method fsync_method;
745-
746689
#define MTIME_CHANGED 0x0001
747690
#define CTIME_CHANGED 0x0002
748691
#define OWNER_CHANGED 0x0004
@@ -1045,29 +988,12 @@ int update_server_info(int);
1045988
extern const char *git_mailmap_file;
1046989
extern const char *git_mailmap_blob;
1047990

1048-
/* IO helper functions */
1049-
void maybe_flush_or_die(FILE *, const char *);
1050-
__attribute__((format (printf, 2, 3)))
1051-
void fprintf_or_die(FILE *, const char *fmt, ...);
1052-
void fwrite_or_die(FILE *f, const void *buf, size_t count);
1053-
void fflush_or_die(FILE *f);
1054-
1055991
#define COPY_READ_ERROR (-2)
1056992
#define COPY_WRITE_ERROR (-3)
1057993
int copy_fd(int ifd, int ofd);
1058994
int copy_file(const char *dst, const char *src, int mode);
1059995
int copy_file_with_time(const char *dst, const char *src, int mode);
1060996

1061-
void write_or_die(int fd, const void *buf, size_t count);
1062-
void fsync_or_die(int fd, const char *);
1063-
int fsync_component(enum fsync_component component, int fd);
1064-
void fsync_component_or_die(enum fsync_component component, int fd, const char *msg);
1065-
1066-
static inline int batch_fsync_enabled(enum fsync_component component)
1067-
{
1068-
return (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);
1069-
}
1070-
1071997
/* pager.c */
1072998
void setup_pager(void);
1073999
int pager_in_use(void);

config.c

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "setup.h"
3131
#include "worktree.h"
3232
#include "wrapper.h"
33+
#include "write-or-die.h"
3334

3435
struct config_source {
3536
struct config_source *prev;

csum-file.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "cache.h"
55
#include "hash.h"
6+
#include "write-or-die.h"
67

78
struct progress;
89

diagnose.c

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "strvec.h"
1010
#include "object-store.h"
1111
#include "packfile.h"
12+
#include "write-or-die.h"
1213

1314
struct archive_dir {
1415
const char *path;

environment.c

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "setup.h"
2626
#include "shallow.h"
2727
#include "wrapper.h"
28+
#include "write-or-die.h"
2829

2930
int trust_executable_bit = 1;
3031
int trust_ctime = 1;

http-backend.c

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "protocol.h"
1919
#include "date.h"
2020
#include "wrapper.h"
21+
#include "write-or-die.h"
2122

2223
static const char content_type[] = "Content-Type";
2324
static const char content_length[] = "Content-Length";

log-tree.c

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "help.h"
2424
#include "range-diff.h"
2525
#include "strmap.h"
26+
#include "write-or-die.h"
2627

2728
static struct decoration name_decoration = { "object names" };
2829
static int decoration_loaded;

pkt-line.c

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "hex.h"
55
#include "run-command.h"
66
#include "wrapper.h"
7+
#include "write-or-die.h"
78

89
char packet_buffer[LARGE_PACKET_MAX];
910
static const char *packet_trace_prefix = "git";

refs/files-backend.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "../setup.h"
1818
#include "../worktree.h"
1919
#include "../wrapper.h"
20+
#include "../write-or-die.h"
2021

2122
/*
2223
* This backend uses the following flags in `ref_update::flags` for

refs/packed-backend.c

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "../iterator.h"
1010
#include "../lockfile.h"
1111
#include "../chdir-notify.h"
12+
#include "../write-or-die.h"
1213

1314
enum mmap_strategy {
1415
/*

remote-curl.c

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "protocol.h"
2323
#include "quote.h"
2424
#include "transport.h"
25+
#include "write-or-die.h"
2526

2627
static struct remote *remote;
2728
/* always ends with a trailing slash */

send-pack.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
#include "version.h"
1717
#include "oid-array.h"
1818
#include "gpg-interface.h"
19-
#include "cache.h"
2019
#include "shallow.h"
20+
#include "trace2.h"
21+
#include "write-or-die.h"
2122

2223
int option_parse_push_signed(const struct option *opt,
2324
const char *arg, int unset)

sideband.c

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "sideband.h"
66
#include "help.h"
77
#include "pkt-line.h"
8+
#include "write-or-die.h"
89

910
struct keyword_entry {
1011
/*

t/helper/test-pkt-line.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "test-tool.h"
33
#include "pkt-line.h"
4+
#include "write-or-die.h"
45

56
static void pack_line(const char *line)
67
{

upload-pack.c

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "commit-graph.h"
3131
#include "commit-reach.h"
3232
#include "shallow.h"
33+
#include "write-or-die.h"
3334

3435
/* Remember to update object flag allocation in object.h */
3536
#define THEY_HAVE (1u << 11)

write-or-die.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
#include "cache.h"
1+
#include "git-compat-util.h"
22
#include "config.h"
33
#include "run-command.h"
44
#include "wrapper.h"
5+
#include "write-or-die.h"
56

67
/*
78
* Some cases use stdio, but want to flush after the write

0 commit comments

Comments
 (0)