#include "list.h"
#include "transport.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
struct alt_base {
ret = error("File %s has bad hash", hex);
} else if (req->rename < 0) {
struct strbuf buf = STRBUF_INIT;
- loose_object_path(the_repository, &buf, &req->oid);
+ odb_loose_path(the_repository->objects->odb, &buf, &req->oid);
ret = error("unable to write sha1 filename %s", buf.buf);
strbuf_release(&buf);
}
oidcpy(&freq->oid, oid);
freq->localfile = -1;
- loose_object_path(the_repository, &filename, oid);
+ odb_loose_path(the_repository->objects->odb, &filename, oid);
strbuf_addf(&freq->tmpfile, "%s.temp", filename.buf);
strbuf_addf(&prevfile, "%s.prev", filename.buf);
unlink_or_warn(freq->tmpfile.buf);
return -1;
}
- loose_object_path(the_repository, &filename, &freq->oid);
+ odb_loose_path(the_repository->objects->odb, &filename, &freq->oid);
freq->rename = finalize_object_file(freq->tmpfile.buf, filename.buf);
strbuf_release(&filename);
if (batch_fsync_enabled(FSYNC_COMPONENT_LOOSE_OBJECT))
prepare_loose_object_bulk_checkin();
- loose_object_path(the_repository, &filename, oid);
+ odb_loose_path(the_repository->objects->odb, &filename, oid);
fd = start_loose_object_common(&tmp_file, filename.buf, flags,
&stream, compressed, sizeof(compressed),
goto cleanup;
}
- loose_object_path(the_repository, &filename, oid);
+ odb_loose_path(the_repository->objects->odb, &filename, oid);
/* We finally know the object path, and create the missing dir. */
dirlen = directory_size(filename.buf);
struct object_directory;
+/*
+ * Put in `buf` the name of the file in the local object database that
+ * would be used to store a loose object with the specified oid.
+ */
const char *odb_loose_path(struct object_directory *odb,
struct strbuf *buf,
const struct object_id *oid);
return open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
}
-const char *loose_object_path(struct repository *r, struct strbuf *buf,
- const struct object_id *oid)
-{
- return odb_loose_path(r->objects->odb, buf, oid);
-}
-
/*
* Return non-zero iff the path is usable as an alternate object database.
*/
*/
int odb_pack_keep(const char *name);
-/*
- * Put in `buf` the name of the file in the local object database that
- * would be used to store a loose object with the specified oid.
- */
-const char *loose_object_path(struct repository *r, struct strbuf *buf,
- const struct object_id *oid);
-
void *map_loose_object(struct repository *r, const struct object_id *oid,
unsigned long *size);