Re: git show doesn't work on file names with square brackets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> But having looked at this, I can't help but wonder if the rule should
> not be "does the file exist" in the first place, but "is the file in the
> index". This dwimmery is about commands like "log" that are reading
> existing commits. I cannot think of a case where we would want to
> include something that exists in the filesystem but not in the index.

Yeah, checking in the index, once it is loaded, is reasonably quick
check.  A path that is not in the index or the current HEAD may or
may not exist on the filesystem, so at some point you would need an
explicit disambiguation anyway, and the reason why we check the
filesystem is not because that is conceptually better than checking
in the index but merely because "does lstat(2) tell us the path is
there?" check was fairly a cheap way on the platform the system was
primarily developed on initially.  Looking it up from HEAD would be
a lot more heavyweight and would not buy us anything, but looking it
up in the index may turn out to be comparable to a single lstat(2).

I dunno.  I have a suspicion that anything conceptually more
expensive than a single lstat(2) is probably not worth doing, as
this "sometimes you do not have to give --" is merely a usability
hack, and we have to always do "git log -- removed-sometime-ago"
to find where in the history a certain path was lost.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]