git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: <git@vger.kernel.org>
Cc: Jeff King <peff@peff.net>, Duy Nguyen <pclouds@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jonathan Tan <jonathantanmy@google.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 01/10] t: add helper to convert object IDs to paths
Date: Sun, 16 Jun 2019 18:53:21 +0000	[thread overview]
Message-ID: <20190616185330.549436-2-sandals@crustytoothpaste.net> (raw)
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 () {

  reply	other threads:[~2019-06-16 18:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-16 18:53 [PATCH v2 00/10] Hash-independent tests, part 4 brian m. carlson
2019-06-16 18:53 ` brian m. carlson [this message]
2019-06-17 19:05   ` [PATCH v2 01/10] t: add helper to convert object IDs to paths Johannes Schindelin
2019-06-18  1:29     ` brian m. carlson
2019-06-18  6:14       ` Johannes Sixt
2019-06-18 16:15         ` Johannes Schindelin
2019-06-18 16:55           ` SZEDER Gábor
2019-06-19 19:56             ` Johannes Schindelin
2019-06-18 17:04           ` Jeff King
2019-06-19 19:55             ` Johannes Schindelin
2019-06-18 23:03         ` brian m. carlson
2019-06-16 18:53 ` [PATCH v2 02/10] t1410: make hash size independent brian m. carlson
2019-06-16 18:53 ` [PATCH v2 03/10] t1450: " brian m. carlson
2019-06-16 18:53 ` [PATCH v2 04/10] t5000: make hash independent brian m. carlson
2019-06-16 18:53 ` [PATCH v2 05/10] t6030: make test work with SHA-256 brian m. carlson
2019-06-16 18:53 ` [PATCH v2 06/10] t0027: make hash size independent brian m. carlson
2019-06-16 18:53 ` [PATCH v2 07/10] t0090: make test pass with SHA-256 brian m. carlson
2019-06-16 18:53 ` [PATCH v2 08/10] t1007: remove SHA1 prerequisites brian m. carlson
2019-06-16 18:53 ` [PATCH v2 09/10] t1710: make hash independent brian m. carlson
2019-06-16 18:53 ` [PATCH v2 10/10] t2203: avoid hard-coded object ID values brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190616185330.549436-2-sandals@crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).