Re: [PATCH v4 07/10] introduce fetch-object: fetch one promisor object
On 11/17/2017 3:17 PM, Stefan Beller wrote: On Fri, Nov 17, 2017 at 11:49 AM, Jeff Hostetlerwrote: On 11/16/2017 2:57 PM, Ramsay Jones wrote: On 16/11/17 18:12, Jeff Hostetler wrote: From: Jonathan Tan Introduce fetch-object, providing the ability to fetch one object from a promisor remote. [snip] +#include "transport.h" I note that this still does not #include "fetch_object.h". [If you recall, this suppresses a sparse warning]. Sorry, I missed that. I know I did a DEVELOPER=1 build and I didn't see a warning, but I'll check again. sparse is an extra tool, which you have to run/install; it is not included in the developer build. https://en.wikipedia.org/wiki/Sparse ah, thanks! Jeff
Re: [PATCH v4 07/10] introduce fetch-object: fetch one promisor object
On Fri, Nov 17, 2017 at 11:49 AM, Jeff Hostetlerwrote: > > > On 11/16/2017 2:57 PM, Ramsay Jones wrote: >> >> >> >> On 16/11/17 18:12, Jeff Hostetler wrote: >>> >>> From: Jonathan Tan >>> >>> Introduce fetch-object, providing the ability to fetch one object from a >>> promisor remote. > > [snip] >>> >>> +#include "transport.h" >> >> >> I note that this still does not #include "fetch_object.h". >> [If you recall, this suppresses a sparse warning]. >> > > Sorry, I missed that. I know I did a DEVELOPER=1 build and > I didn't see a warning, but I'll check again. sparse is an extra tool, which you have to run/install; it is not included in the developer build. https://en.wikipedia.org/wiki/Sparse
Re: [PATCH v4 07/10] introduce fetch-object: fetch one promisor object
On 17/11/17 19:49, Jeff Hostetler wrote: > > > On 11/16/2017 2:57 PM, Ramsay Jones wrote: >> >> >> On 16/11/17 18:12, Jeff Hostetler wrote: >>> From: Jonathan Tan>>> >>> Introduce fetch-object, providing the ability to fetch one object from a >>> promisor remote. > [snip] >>> +#include "transport.h" >> >> I note that this still does not #include "fetch_object.h". >> [If you recall, this suppresses a sparse warning]. >> > > Sorry, I missed that. I know I did a DEVELOPER=1 build and > I didn't see a warning, but I'll check again. Unless you have sparse installed and 'make sparse' as part of your build, you won't see anything. ;-) However, ignore sparse for the moment, if you don't #include the header (interface) file in fetch-object.c, you can't expect the compiler to tell you when there is a mismatch between the interface and implementation. There are some additional sparse warnings associated with these series, ... (hopefully I can find some time tonight) ATB, Ramsay Jones
Re: [PATCH v4 07/10] introduce fetch-object: fetch one promisor object
On 11/16/2017 2:57 PM, Ramsay Jones wrote: On 16/11/17 18:12, Jeff Hostetler wrote: From: Jonathan TanIntroduce fetch-object, providing the ability to fetch one object from a promisor remote. [snip] +#include "transport.h" I note that this still does not #include "fetch_object.h". [If you recall, this suppresses a sparse warning]. Sorry, I missed that. I know I did a DEVELOPER=1 build and I didn't see a warning, but I'll check again. Thanks, Jeff
Re: [PATCH v4 07/10] introduce fetch-object: fetch one promisor object
On 16/11/17 18:12, Jeff Hostetler wrote: > From: Jonathan Tan> > Introduce fetch-object, providing the ability to fetch one object from a > promisor remote. > > This uses fetch-pack. To do this, the transport mechanism has been > updated with 2 flags, "from-promisor" to indicate that the resulting > pack comes from a promisor remote (and thus should be annotated as such > by index-pack), and "no-haves" to suppress the sending of "have" lines. > > This will be tested in a subsequent commit. > > NEEDSWORK: update this when we have more information about protocol v2, > which should allow a way to suppress the ref advertisement and > officially allow any object type to be "want"-ed. > > Signed-off-by: Jonathan Tan > --- > Documentation/gitremote-helpers.txt | 6 ++ > Makefile| 1 + > builtin/fetch-pack.c| 8 > builtin/index-pack.c| 16 +--- > fetch-object.c | 23 +++ > fetch-object.h | 6 ++ > fetch-pack.c| 8 ++-- > fetch-pack.h| 2 ++ > remote-curl.c | 14 +- > transport.c | 8 > transport.h | 8 > 11 files changed, 94 insertions(+), 6 deletions(-) > create mode 100644 fetch-object.c > create mode 100644 fetch-object.h > [snip] > diff --git a/fetch-object.c b/fetch-object.c > new file mode 100644 > index 000..f89dbba > --- /dev/null > +++ b/fetch-object.c > @@ -0,0 +1,23 @@ > +#include "cache.h" > +#include "packfile.h" > +#include "pkt-line.h" > +#include "strbuf.h" > +#include "transport.h" I note that this still does not #include "fetch_object.h". [If you recall, this suppresses a sparse warning]. > + > +void fetch_object(const char *remote_name, const unsigned char *sha1) > +{ > + struct remote *remote; > + struct transport *transport; > + struct ref *ref; > + > + remote = remote_get(remote_name); > + if (!remote->url[0]) > + die(_("Remote with no URL")); > + transport = transport_get(remote, remote->url[0]); > + > + ref = alloc_ref(sha1_to_hex(sha1)); > + hashcpy(ref->old_oid.hash, sha1); > + transport_set_option(transport, TRANS_OPT_FROM_PROMISOR, "1"); > + transport_set_option(transport, TRANS_OPT_NO_HAVES, "1"); > + transport_fetch_refs(transport, ref); > +} > diff --git a/fetch-object.h b/fetch-object.h > new file mode 100644 > index 000..f371300 > --- /dev/null > +++ b/fetch-object.h > @@ -0,0 +1,6 @@ > +#ifndef FETCH_OBJECT_H > +#define FETCH_OBJECT_H > + > +extern void fetch_object(const char *remote_name, const unsigned char *sha1); > + > +#endif ATB, Ramsay Jones