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

2016-08-31 Thread Junio C Hamano
Johannes Schindelin writes: >> > + if (S_ISREG(mode)) { >> > + struct strbuf strbuf = STRBUF_INIT; >> > + if (convert_to_working_tree(path, *buf, *size, )) { >> > + free(*buf); >> > + *size = strbuf.len; >> > +

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

2016-08-31 Thread Johannes Schindelin
Hi Junio, On Wed, 24 Aug 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) > > +{ >

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

2016-08-24 Thread Junio C Hamano
Junio C Hamano writes: >> +test_expect_success 'setup ' ' >> +echo "*.txt eol=crlf diff=txt" >.gitattributes && >> +echo "hello" | append_cr >world.txt && >> +git add .gitattributes world.txt && > > git update-index --cacheinfo :world.txt,$EMPTY_BLOB,symlink

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

2016-08-24 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 =

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

2016-08-24 Thread Johannes Schindelin
The --filters option applies the convert_to_working_tree() filter for the path when showing the contents of a regular file blob object. This feature comes in handy when a 3rd-party tool wants to work with the contents of files from past revisions as if they had been checked out, but without