Re: [PATCH 6/9] git-hash-object: Add --stdin-paths option
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:44
bdowning@lavos.net (Brian Downing) writes:
On Fri, Oct 26, 2007 at 02:00:47PM -0700, Junio C Hamano wrote:quoted
In addition, if you are enhancing cat-file to spew chunked output out, I suspect that there should be a mode of operation for hash-object that eats that data format. IOW, this pipe git-cat-file --batch <list-of-sha1 | git-hash-object --batch should be an intuitive no-op, shouldn't it?I think that's an obviously good thing to do. However, given your suggested output format (which I also like):quoted
* git-cat-file --batch <list-of-sha1 outputs a record of this form <sha1> SP <type> SP <size> LF <contents> LF for each of the input lines.What should the input behavior be? Obviously the sha1 will probably not be known on the input side. Should that simply be optional (i.e. it will accept either "<sha1> SP <type> SP <size>" or "<type> SP <size>" or should it only accept the latter, and a dummy sha1 will need to be filled in if the sha1 is not known (presumably "000...000")?
Yeah, you caught me ;-) Either making it optional or requiring a dummy value would work. If a non-dummy value is given, we could use it to validate it. But that would not be a useful application anyway. So perhaps just the sequence of "<type> SP <size> LF <contents> LF" would be the most sensible thing to do.