5 ms·
I've recently had a similar idea for when you want to track metrics of a Git repository over time (code size, line count, etc). I would love to create some a s
by haberman 5y ago
I've recently had a similar idea for when you want to track metrics of a Git repository over time (code size, line count, etc).
I would love to create some a script to take a measurement of the current tree, then run a tool that runs my script at ~every commit so I can draw a graph of how the metric changes over time.
It's a bit tricky: if you change the script, you need to re-run the analysis at every commit. It starts looking a little bit like a build system, but integrated over time.
I've thought of calling this GitReduce or similar, since it has some similarity to MapReduce: first a "map" step runs at every commit, then the "reduce" step combines all of the individual outputs into a single graph or whatever.
Ideally Git itself could be the only storage engine, so you can trivially serve the results from GitHub.
- sulZ 5y agogit provides a couple of options for running a script against the code for every commit
- Too 5y agoEven without built in options, writing a for-loop over the result of git log or rev-list is more or less two lines of scripting. Same with a walk over rev-parse HEAD^. Then you also have git bisect but that's more for finding when some metric started to show anomalies.
- divbzero 5y agoWould that be git for-each-ref [1] or something different? [1]: https://git-scm.com/docs/git-for-each-ref https://git-scm.com/docs/git-for-each-ref
- remram 5y agoCommits are not refs, only the head of a branch (or tag) is a ref.
- deleted 5y ago[deleted]