From: Johannes Schindelin Date: Tue, 20 Jan 2009 21:02:16 GMT Subject: Re: [PATCH] diff: Support diff.color-words config option Message-ID: In-Reply-To: <7vk58pk9k5.fsf@gitster.siamese.dyndns.org> Hi, On Tue, 20 Jan 2009, Junio C Hamano wrote: > Johannes Schindelin writes: > > >> By the way, wouldn't it make sense to optimize the precontext of that > >> hunk by doing _something_ like: > >> > >> if (!o->word_regex && strcmp(one->path, two->path)) > >> o->word_regex = userdiff_word_regex(two); > >> > >> "Something like" comes from special cases like /dev/null for new/deleted > >> files, etc. > > > > You mean to avoid the cost of initializing the regex in case one and the > > same file is diffed against itself? > > No. > > What I meant is much simpler than that. > > If one and two are the same filename, and earlier gitattributes lookup for > the path already failed to produce any when you checked one, isn't it very > likely that the gitattributes lookup for two would fail the same way to > produce any result? Oh, I see! Thanks, Dscho