Merge branch 'jc/for-each-ref' into jc/ref-locking