Subject: Re: Possible improvement in DB structure

From: Jonathan Nieder <[email-masked]>
Date: Mon, 23 Dec 2019 13:41:25 -0800

Hi Arnaud,

Arnaud Bertrand wrote:

> Today, I think that tags are not located in objects directory but in
> refs/tags which is a good idea.;-)

Not precisely.  See "git help repository-layout" for more details, or
https://www.kernel.org/pub/software/scm/git/docs/user-manual.html#hacking-git
or the "git internals" chapter of https://git-scm.com/book/.

> The origin of my reflection was that I wanted to find an old file.
>
> I knew that in the past of my project, we had started to write a
> driver for a device and it was abandoned. I wanted to find this file.
> I knew a "key line" to search for and I knew the file was a .c file
> but I didn't know the exact name.

Thanks for this context!  It's very helpful.

> So, the goal was to parse all the database, find all the different .c
> files and grep it to find the the driver.

Git intends to make this kind of history mining not too difficult.
You can run a command like

	git log --all -S'the key line' -- '*.c'

and it should do the right thing.  Or you can do something more
complex using something like "git rev-list --all | git diff-tree
--stdin --name-only --diff-filter=D" (to show deleted files).

Is the problem that that command is too slow?

Hope that helps,
Jonathan