refs->gitdir = xstrdup(path);
}
-/* backend functions */
-int refs_pack_refs(struct ref_store *refs, struct pack_refs_opts *opts)
-{
- return refs->be->pack_refs(refs, opts);
-}
-
int refs_optimize(struct ref_store *refs, struct pack_refs_opts *opts)
{
return refs->be->optimize(refs, opts);
struct string_list *includes;
};
-/*
- * Write a packed-refs file for the current repository.
- * flags: Combination of the above PACK_REFS_* flags.
- */
-int refs_pack_refs(struct ref_store *refs, struct pack_refs_opts *opts);
-
/*
* Optimize the ref store. The exact behavior is up to the backend.
* For the files backend, this is equivalent to packing refs.
return res;
}
-static int debug_pack_refs(struct ref_store *ref_store, struct pack_refs_opts *opts)
+static int debug_optimize(struct ref_store *ref_store, struct pack_refs_opts *opts)
{
struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
- int res = drefs->refs->be->pack_refs(drefs->refs, opts);
- trace_printf_key(&trace_refs, "pack_refs: %d\n", res);
+ int res = drefs->refs->be->optimize(drefs->refs, opts);
+ trace_printf_key(&trace_refs, "optimize: %d\n", res);
return res;
}
.transaction_finish = debug_transaction_finish,
.transaction_abort = debug_transaction_abort,
- .pack_refs = debug_pack_refs,
+ .optimize = debug_optimize,
.rename_ref = debug_rename_ref,
.copy_ref = debug_copy_ref,
return 0;
}
-static int files_pack_refs(struct ref_store *ref_store,
- struct pack_refs_opts *opts)
+static int files_optimize(struct ref_store *ref_store,
+ struct pack_refs_opts *opts)
{
struct files_ref_store *refs =
files_downcast(ref_store, REF_STORE_WRITE | REF_STORE_ODB,
return 0;
}
-static int files_optimize(struct ref_store *ref_store, struct pack_refs_opts *opts)
-{
- /*
- * For the "files" backend, "optimizing" is the same as "packing".
- * So, we just call the existing worker function for packing.
- */
- return files_pack_refs(ref_store, opts);
-}
-
/*
* People using contrib's git-new-workdir have .git/logs/refs ->
* /some/other/path/.git/logs/refs, and that may live on another device.
.transaction_finish = files_transaction_finish,
.transaction_abort = files_transaction_abort,
- .pack_refs = files_pack_refs,
.optimize = files_optimize,
.rename_ref = files_rename_ref,
.copy_ref = files_copy_ref,
return ret;
}
-static int packed_pack_refs(struct ref_store *ref_store UNUSED,
- struct pack_refs_opts *pack_opts UNUSED)
+static int packed_optimize(struct ref_store *ref_store UNUSED,
+ struct pack_refs_opts *pack_opts UNUSED)
{
/*
* Packed refs are already packed. It might be that loose refs
.transaction_finish = packed_transaction_finish,
.transaction_abort = packed_transaction_abort,
- .pack_refs = packed_pack_refs,
+ .optimize = packed_optimize,
.rename_ref = NULL,
.copy_ref = NULL,
struct ref_transaction *transaction,
struct strbuf *err);
-typedef int pack_refs_fn(struct ref_store *ref_store,
- struct pack_refs_opts *opts);
typedef int optimize_fn(struct ref_store *ref_store,
struct pack_refs_opts *opts);
typedef int rename_ref_fn(struct ref_store *ref_store,
ref_transaction_finish_fn *transaction_finish;
ref_transaction_abort_fn *transaction_abort;
- pack_refs_fn *pack_refs;
optimize_fn *optimize;
rename_ref_fn *rename_ref;
copy_ref_fn *copy_ref;
return ret;
}
-static int reftable_be_pack_refs(struct ref_store *ref_store,
- struct pack_refs_opts *opts)
+static int reftable_be_optimize(struct ref_store *ref_store,
+ struct pack_refs_opts *opts)
{
struct reftable_ref_store *refs =
- reftable_be_downcast(ref_store, REF_STORE_WRITE | REF_STORE_ODB, "pack_refs");
+ reftable_be_downcast(ref_store, REF_STORE_WRITE | REF_STORE_ODB, "optimize_refs");
struct reftable_stack *stack;
int ret;
return ret;
}
-static int reftable_be_optimize(struct ref_store *ref_store,
- struct pack_refs_opts *opts)
-{
- return reftable_be_pack_refs(ref_store, opts);
-}
-
struct write_create_symref_arg {
struct reftable_ref_store *refs;
struct reftable_stack *stack;
.transaction_finish = reftable_be_transaction_finish,
.transaction_abort = reftable_be_transaction_abort,
- .pack_refs = reftable_be_pack_refs,
.optimize = reftable_be_optimize,
.rename_ref = reftable_be_rename_ref,
.copy_ref = reftable_be_copy_ref,