bundle.h: make "fd" version of read_bundle_header() public

Change the parse_bundle_header() function to be non-static, and rename it to parse_bundle_header_fd(). The parse_bundle_header() function is already public, and it's a thin wrapper around this function. This will be used by code that wants to pass a fd to the bundle API. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed May 16, 2022 at 20:11 UTC 89c6e450fe4a919ecb6fa698005a935531c732cf
2 files changed +6 -4
bundle.c
+4 -4
@@ -66,8 +66,8 @@ static int parse_bundle_signature(struct bundle_header *header, const char *line
66 return -1;
67 }
68
69 -static int parse_bundle_header(int fd, struct bundle_header *header,
70 - const char *report_path)
69 +int read_bundle_header_fd(int fd, struct bundle_header *header,
70 + const char *report_path)
71 {
72 struct strbuf buf = STRBUF_INIT;
73 int status = 0;
@@ -143,7 +143,7 @@ int read_bundle_header(const char *path, struct bundle_header *header)
143
144 if (fd < 0)
145 return error(_("could not open '%s'"), path);
146 - return parse_bundle_header(fd, header, path);
146 + return read_bundle_header_fd(fd, header, path);
147 }
148
149 int is_bundle(const char *path, int quiet)
@@ -153,7 +153,7 @@ int is_bundle(const char *path, int quiet)
153
154 if (fd < 0)
155 return 0;
156 - fd = parse_bundle_header(fd, &header, quiet ? NULL : path);
156 + fd = read_bundle_header_fd(fd, &header, quiet ? NULL : path);
157 if (fd >= 0)
158 close(fd);
159 bundle_header_release(&header);
bundle.h
+2
@@ -24,6 +24,8 @@ void bundle_header_release(struct bundle_header *header);
24
25 int is_bundle(const char *path, int quiet);
26 int read_bundle_header(const char *path, struct bundle_header *header);
27 +int read_bundle_header_fd(int fd, struct bundle_header *header,
28 + const char *report_path);
29 int create_bundle(struct repository *r, const char *path,
30 int argc, const char **argv, struct strvec *pack_options,
31 int version);