Re: [PATCH v3 2/4] cat-file: introduce the --filters option

2016-09-11 Thread Junio C Hamano
Johannes Schindelin writes: >> In other words, instead of trying to be consistent by erroring out >> in non-regular blob case, I think the attached change on top would >> make more sense, by consistently passing the object contents as-is >> for all "not filtered" cases, whether it is run from the

Re: [PATCH v3 2/4] cat-file: introduce the --filters option

2016-09-10 Thread Johannes Schindelin
Hi Junio, On Fri, 9 Sep 2016, Junio C Hamano wrote: > Junio C Hamano writes: > > > So I would not mind if we define the semantics of "--filters" as > > such (as long as it is clearly documented, of course). AFAICS, the > > batch interface does not call filter_object() for non-blobs, and by > >

Re: [PATCH v3 2/4] cat-file: introduce the --filters option

2016-09-09 Thread Junio C Hamano
Junio C Hamano writes: > So I would not mind if we define the semantics of "--filters" as > such (as long as it is clearly documented, of course). AFAICS, the > batch interface does not call filter_object() for non-blobs, and by > returning successfully without doing anything special for a symbo

Re: [PATCH v3 2/4] cat-file: introduce the --filters option

2016-09-09 Thread Junio C Hamano
Junio C Hamano writes: > Johannes Schindelin writes: > >>> > + if (type != OBJ_BLOB) { >>> > + free(*buf); >>> > + return error(_("blob expected for %s '%s'"), >>> > + sha1_to_hex(sha1), path); >>> > + } >>> > + if (S_ISREG(mode)) { >>> > + struct strbuf s

Re: [PATCH v3 2/4] cat-file: introduce the --filters option

2016-09-09 Thread Junio C Hamano
Johannes Schindelin writes: >> > + if (type != OBJ_BLOB) { >> > + free(*buf); >> > + return error(_("blob expected for %s '%s'"), >> > + sha1_to_hex(sha1), path); >> > + } >> > + if (S_ISREG(mode)) { >> > + struct strbuf strbuf = STRBUF_INIT; >> > +

Re: [PATCH v3 2/4] cat-file: introduce the --filters option

2016-09-09 Thread Johannes Schindelin
Hi Junio, On Fri, 9 Sep 2016, Junio C Hamano wrote: > Johannes Schindelin writes: > > > +static int filter_object(const char *path, unsigned mode, > > +const unsigned char *sha1, > > +char **buf, unsigned long *size) > > +{ > > + enum object_type type;

Re: [PATCH v3 2/4] cat-file: introduce the --filters option

2016-09-09 Thread Junio C Hamano
Johannes Schindelin writes: > +static int filter_object(const char *path, unsigned mode, > + const unsigned char *sha1, > + char **buf, unsigned long *size) > +{ > + enum object_type type; > + > + *buf = read_sha1_file(sha1, &type, size); > +