git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 01/10] t: add helper to convert object IDs to paths

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 16, 2019, 18:53 UTC
Message-ID
<20190616185330.549436-2-sandals@crustytoothpaste.net>
In-Reply-To
<20190616185330.549436-1-sandals@crustytoothpaste.net>

There are several places in our testsuite where we want to insert a slash after an object ID to make it into a path we can reference under .git/objects, and we have various ways of doing so. Add a helper to provide a standard way of doing this that works for all size hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 t/test-lib-functions.sh | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 8270de74be..11a6abca2e 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1314,6 +1314,12 @@ 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 () {
+	echo "$1" | sed -e 's!^..!&/!'
+}
+
 # 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 () {
Previous: brian m. carlsonNext: Johannes Schindelin
Message 2 of 20 in “Hash-independent tests, part 4”
  1. 00/10 Hash-independent tests, part 4brian m. carlson, Jun 16, 2019
  2. 01/10 t: add helper to convert object IDs to pathsbrian m. carlson, Jun 16, 2019
  3. Johannes SchindelinJun 17, 2019
  4. brian m. carlsonJun 18, 2019
  5. Johannes SixtJun 18, 2019
  6. Johannes SchindelinJun 18, 2019
  7. SZEDER GáborJun 18, 2019
  8. Johannes SchindelinJun 19, 2019
  9. Jeff KingJun 18, 2019
  10. Johannes SchindelinJun 19, 2019
  11. brian m. carlsonJun 18, 2019
  12. 02/10 t1410: make hash size independentbrian m. carlson, Jun 16, 2019
  13. 03/10 t1450: make hash size independentbrian m. carlson, Jun 16, 2019
  14. 04/10 t5000: make hash independentbrian m. carlson, Jun 16, 2019
  15. 06/10 t0027: make hash size independentbrian m. carlson, Jun 16, 2019
  16. 05/10 t6030: make test work with SHA-256brian m. carlson, Jun 16, 2019
  17. 07/10 t0090: make test pass with SHA-256brian m. carlson, Jun 16, 2019
  18. 08/10 t1007: remove SHA1 prerequisitesbrian m. carlson, Jun 16, 2019
  19. 09/10 t1710: make hash independentbrian m. carlson, Jun 16, 2019
  20. 10/10 t2203: avoid hard-coded object ID valuesbrian m. carlson, Jun 16, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.