Re: Bug: problem with file named with dash character
- From
Jeff King <peff@peff.net>
- Date
- Jun 27, 2012, 21:00 UTC
- Message-ID
- <20120627210039.GA2292@sigill.intra.peff.net>
- In-Reply-To
- <7vvcic7a6t.fsf@alter.siamese.dyndns.org>
On Wed, Jun 27, 2012 at 01:48:42PM -0700, Junio C Hamano wrote:
Show 8 quoted lines
> >>> It is not ready yet, but here are a few patches WIP. > >> > >> And this is the second clean-up > > > > And this is the third one. > > Some of the other breakages that comes from the "no-index" codepath > that we may want to consider addressing I have found so far are:
>From a cursory look, these definitely go in the right direction. I like
how the third one was able to rip populate_from_stdin entirely out of diff.c.
I suspect we could get by without even the nongit_stdin flag you added; the only place which uses it is diff_fill_sha1_info, but theoretically we don't even need it there; we could just index_mem the file contents we get via diff_populate_filespec, and the stdin contents will already be there.
Right now we call index_path for worktree files, but I don't really see much point; we have to read the whole data either way, and populate_filespec should be mmap-ing them for us.
> - We say on the "diff --git" header uglyness like "a/-", "b/-"; > likewise in the metainfo;
I'd consider changing the path to "/dev/stdin" for this case. It doesn't exist on some platforms, of course, but neither does /dev/null, which we use similarly.
> - We show on the "index" header "0*" value for these entries, even > though we should be able to compute it (after all we do so for > files on disk in a non-git directory);
The index_mem I mentioned above would fix that.
> - We still apply attributes and textconv as if we are dealing with > a regular file "-" at the root level.
I think that's bad. I wonder if it should have "*" attributes applied to it or not. While I can see it being convenient in some cases, I think it makes the rules confusingly complex.
-Peff