On Tue, Mar 05, 2019 at 10:33:13PM +0900, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > >> Or teach git-blame to have its own pretend mechanism, and remove the > >> pretend mechanism from sha1-file.c. > > > > I think that would be ideal, but I'm not sure if it's feasible due to > > the layering of the various modules. > > Sorry, but I do not get why we want command-line specific pretend > mechanism. When one part of the system wants to behave as if object > X exists, doesn't that part want other parts of the system to share > that same world view to be consistent? > > I am mostly reacting to "would be _ideal_"; if it were "if we have > per-system ad-hoc pretend mechanism, things like this and that would > become easier to implement, even though that is an ugly hack", I may > agree when I see examples of things that get easier, though. The problem is that it's not clear how each of those other parts of the system should react to these pretend objects. E.g., they probably should _not_ be used in any operation that might write, since we would not want to create a permanent object that points to an ephemeral one. By sticking this in sha1-file.c, it becomes hard to know who will access them, or with what expectations. Things work right now because we use the feature sparingly (and only from a process that's purely read-only). But we're at risk of somebody later misusing it, especially if we spread its use to more functions like has_object_file(). If this were local to git-blame, then that risk goes away. So that's what I meant by "ideal". I don't think it makes anything easier (in fact, after looking, I think it makes things in git-blame much harder, to the point that I am not planning to work on it anytime soon). -Peff