Using Askgit – A SQL interface to your Git repository
willschenk.com
willschenk.com
(Though I recognize that the entire askgit here is essentially a layer on top of some existing functionality).
But changes to a specific function is a particularly underused feature in git.
You do `git log -L :nameOfFunction:fileItLives.ext` and git will show you changes to the function over time.
Of course that syntax is completely arcane (which contributes to its underuse), but e.g. for Python I just wrote a trivial thing to let me instead write `git pylog foo.bar.baz` and it translates to the right syntax above (that lives here: https://github.com/Julian/dotfiles/blob/76bd63f6c9a2c650c185...)
I've been considering leveraging the syntax highlighting implementation in editors to make this possible (rather than something as heavy handed as parsing a "universal" AST, though I know there are projects to do this)...
https://docs.microsoft.com/en-us/visualstudio/ide/find-code-...
I think Rider has it as well.
It also let's you join them with each other (and other databases).
I haven't used it directly, but I did use a Perl module that hooks into it, and that made it very easy to cobble together. https://metacpan.org/pod/release/SALVA/SQLite-VirtualTable-0...
The main Achille's Heel of VTAB is wrapping your head around the indexing API: the basic idea is you need to tell the query planner which of a set of columns is best to work with. It is exceedingly unintuitive. This is compounded by the problem that the planner essentially refuses to do binary-search queries on more than one column of a VTAB. (Hell -- getting it to use any binary-search on any index is nearly impossible.) The result is that unless you're in a real bind, you should always translate your custom VTAB data into a reified table.
This is all compounded by the fact that the slightest misstep in the callback API will corrupt/confuse/lockup SQLite (the in-memory representation -- your data is still safe). I'm glad VTAB exists, and I know it's just a side-effect of the compression support, but goddamn it's frustrating for it to be almost be awesome...
mercurial offers a language where you can build expressions to select revsets:
E.g.
> Changesets mentioning "bug" or "issue" that are not in a tagged release:
hg log -r "(keyword(bug) or keyword(issue)) and not ancestors(tag())"
I also like go-git[1] - a pure Go implementation with idiomatic Go API and cool features like in-memory filesystem.
Next logical step : a kernel level SQL interpreter integrated in systemd.
I get why a lot of developers take swipes at SQL - it is a bit different to other languages. But you cannot beat it for what it does.
Another ‘great’ language is XSLT - so far I’ve seen nothing else that comes close for transforming data. It’s just a shame it’s so closely tied to XML which has understandably fallen out of favour
[1]: https://docs.microsoft.com/en-us/windows/win32/wmisdk/queryi...
It is by design that something like this is not included into the original interface. It would be. terrible design.