git/bundle.h
Junio C Hamano 2727b71f05 bundle: add parse_bundle_header() helper function
Move most of the code from read_bundle_header() to parse_bundle_header()
that takes a file descriptor that is already opened for reading, and make
the former responsible only for opening the file and noticing errors.

As a logical consequence of this, is_bundle() helper function can be
implemented as a non-complaining variant of read_bundle_header() that
does not return an open file descriptor, and can be used to tighten
the check used to decide the use of bundle transport in transport_get()
function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 15:50:21 -07:00

27 lines
671 B
C

#ifndef BUNDLE_H
#define BUNDLE_H
struct ref_list {
unsigned int nr, alloc;
struct ref_list_entry {
unsigned char sha1[20];
char *name;
} *list;
};
struct bundle_header {
struct ref_list prerequisites;
struct ref_list references;
};
int is_bundle(const char *path, int quiet);
int read_bundle_header(const char *path, struct bundle_header *header);
int create_bundle(struct bundle_header *header, const char *path,
int argc, const char **argv);
int verify_bundle(struct bundle_header *header, int verbose);
int unbundle(struct bundle_header *header, int bundle_fd);
int list_bundle_refs(struct bundle_header *header,
int argc, const char **argv);
#endif