On Thu, Aug 3, 2017 at 9:52 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Christian Couder <christian.couder@xxxxxxxxx> writes: > >> The mechanism to decide which blobs should be sent to which >> external object database will be very simple for now. >> If the external odb helper support any "put_*" instruction >> all the new blobs will be sent to it. >> >> Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx> >> --- >> external-odb.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/external-odb.c b/external-odb.c >> index 82fac702e8..a4f8c72e1c 100644 >> --- a/external-odb.c >> +++ b/external-odb.c >> @@ -124,6 +124,10 @@ int external_odb_put_object(const void *buf, size_t len, >> { >> struct odb_helper *o; >> >> + /* For now accept only blobs */ >> + if (strcmp(type, "blob")) >> + return 1; >> + > > I somehow doubt that a policy decision like this should be made at > this layer. Shouldn't it be encoded in the capability the other > side supports, or determined at runtime per each individual object > when a "put" is attempted (i.e. allow the other side to say "You > tell me that you want me to store an object of type X and size Y; > I cannot do that, sorry"). I agree that it would be conceptually better to be able to support other kind of objects in external odb, but realistically most use cases for 'get_*' and 'put_*' instructions are for storing/retrieving blobs as other kind of objects are in specific formats that are well supported by the current object store. I also agree that it would be a nice feature if external odb could decide by themselves which objects they accept and I really want to leave the door open to a future improvement implementing that using the capability mechanism or perhaps another mechanism. For now though in "[PATCH v5 34/40] external-odb: use 'odb=magic' attribute to mark odb blobs" the attribute system is used to decide which blobs are put into which external odb as it is probably good enough for many use cases. It is also simple to implement in Git and makes helpers simpler to implement.