Commit e12f8677 authored by Ben Avison's avatar Ben Avison

[prodcommit] Speed optimisation

Previously, `prodcommit` used `git submodule summary --cached` as the basis
of the commit log it generated, and then proceeded to throw away much of the
information it provided. Now, this command is extremely slow, especially on
Windows machines where it can take a minute or more to execute. Replace this
with one of the plumbing commands that `git submodule` used internally, viz
`git diff-index --cached HEAD`, which provides most of the information it
needed, but far faster  (more like 0.1 seconds). The one catch is that it
reports the state of all changed items in the tree, not just the submodules,
but due to the way we structure superprojects, we can simply assume that
anything within the top-level `RiscOS` directory is a submodule.

The commands that determine whether a given submodule is a regression, as
well as the embedded invocation of `git commit`, remain relatively slow
operations on Windows, but the overall process is typically now about 3 times
faster than it was previously.
parent 77f79bac
git submodule summary --cached 2>/dev/null | awk \
'/^\*/ {
split($3, hash, "[.]{3}")
if (hash[1] == "0000000")
new_components[path] = hash[2]
else if (hash[2] == "0000000:")
removed_components[path] = hash[1]
git diff-index --cached HEAD | awk \
'$6 ~ /^RiscOS\// {
if ($3 == "0000000000000000000000000000000000000000")
new_components[$6] = $4
else if ($4 == "0000000000000000000000000000000000000000")
removed_components[$6] = $3
changed_components[path] = hash[1] " " hash[2]
changed_components[$6] = $3 " " $4
function get_tag(path, hash) {
cmd = "cd '\''" path "'\'' && git describe --abbrev=8 --tags --always " hash
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment