Merge branch 'sg/commit-graph-validate'
[gitweb.git] / t / test-lib-functions.sh
index d4f199391f1abe839e55d5abab8a9476fbfc1d35..e0b3f28d3a96e1b937f4c31e0a3d2e8fb3e6fed5 100644 (file)
@@ -1430,6 +1430,13 @@ test_oid () {
        eval "printf '%s' \"\${$var}\""
 }
 
+# Insert a slash into an object ID so it can be used to reference a location
+# under ".git/objects".  For example, "deadbeef..." becomes "de/adbeef..".
+test_oid_to_path () {
+       local basename=${1#??}
+       echo "${1%$basename}/$basename"
+}
+
 # Choose a port number based on the test script's number and store it in
 # the given variable name, unless that variable already contains a number.
 test_set_port () {