From: Junio C Hamano Date: Wed, 23 May 2012 16:56:36 GMT Subject: Re: [PATCH 3/3] refs: use strings directly in find_containing_dir() Message-ID: <7v4nr625vf.fsf@alter.siamese.dyndns.org> In-Reply-To: <4FBD0E33.4060309@lsrfire.ath.cx> René Scharfe writes: > Am 23.05.2012 00:18, schrieb Junio C Hamano: >> René Scharfe writes: >> >>> What has git grep to do with refs? It checks if the path in the command >>> above is a ref, which makes it iterate over all of them.. >> >> Do you mean: >> >> /* Is it a rev? */ >> get_sha1() >> -> ... >> -> get_sha1_basic() >> -> dwim_ref() >> >> callpath? > > Yes, indeed. Hmm, this is done even if the paths come after a > double-dash. Anyway, I don't consider the check to be a performance > issue, just a quick way to test the allocation count that i stumbled > upon while working on the recent grep patches. I was merely reacting "iterate over all of them"; dwim_ref() only checks if .git/blah, .git/refs/heads/blah, .git/refs/tags/blah, etc. exists and the number of checks do not depend on the number of refs you have, so I was wondering if I overlooked something that does for_each_ref() of everything.