entry: make fstat_output() and read_blob_entry() public
These two functions will be used by the parallel checkout code, so let's make them public. Note: fstat_output() is renamed to fstat_checkout_output(), now that it has become public, seeking to avoid future name collisions. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matheus Tavares committed
Mar 23, 2021 at 11:19 UTC
49cfd9032a5c1ef7401b79eff8db471b4c6ed7ef
2 files changed
+7
-4
entry.c
+4
-4
@@ -84,7 +84,7 @@ static int create_file(const char *path, unsigned int mode)
84
return open(path, O_WRONLY | O_CREAT | O_EXCL, mode);
85
}
86
87
-static void *read_blob_entry(const struct cache_entry *ce, unsigned long *size)
87
+void *read_blob_entry(const struct cache_entry *ce, unsigned long *size)
88
{
89
enum object_type type;
90
void *blob_data = read_object_file(&ce->oid, &type, size);
@@ -109,7 +109,7 @@ static int open_output_fd(char *path, const struct cache_entry *ce, int to_tempf
109
}
110
}
111
112
-static int fstat_output(int fd, const struct checkout *state, struct stat *st)
112
+int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st)
113
{
114
/* use fstat() only when path == ce->name */
115
if (fstat_is_reliable() &&
@@ -132,7 +132,7 @@ static int streaming_write_entry(const struct cache_entry *ce, char *path,
132
return -1;
133
134
result |= stream_blob_to_fd(fd, &ce->oid, filter, 1);
135
- *fstat_done = fstat_output(fd, state, statbuf);
135
+ *fstat_done = fstat_checkout_output(fd, state, statbuf);
136
result |= close(fd);
137
138
if (result)
@@ -346,7 +346,7 @@ static int write_entry(struct cache_entry *ce,
346
347
wrote = write_in_full(fd, new_blob, size);
348
if (!to_tempfile)
349
- fstat_done = fstat_output(fd, state, &st);
349
+ fstat_done = fstat_checkout_output(fd, state, &st);
350
close(fd);
351
free(new_blob);
352
if (wrote < 0)
entry.h
+3
@@ -39,4 +39,7 @@ int finish_delayed_checkout(struct checkout *state, int *nr_checkouts);
39
*/
40
void unlink_entry(const struct cache_entry *ce);
41
42
+void *read_blob_entry(const struct cache_entry *ce, unsigned long *size);
43
+int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st);
44
+
45
#endif /* ENTRY_H */