From patchwork Sun Jun 9 22:43:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "brian m. carlson" X-Patchwork-Id: 10983875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B2141398 for ; Sun, 9 Jun 2019 22:44:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B1A028800 for ; Sun, 9 Jun 2019 22:44:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB96E28806; Sun, 9 Jun 2019 22:44:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B85928800 for ; Sun, 9 Jun 2019 22:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729774AbfFIWoN (ORCPT ); Sun, 9 Jun 2019 18:44:13 -0400 Received: from injection.crustytoothpaste.net ([192.241.140.119]:37544 "EHLO injection.crustytoothpaste.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729692AbfFIWoN (ORCPT ); Sun, 9 Jun 2019 18:44:13 -0400 Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:1504:7263:609b:f73f]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 94EAF61B2F; Sun, 9 Jun 2019 22:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1560120252; bh=THkXpYsWQaFWlRkTvkgkbl/qnwONG7PXumiGdx2GvBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Reply-To: Subject:Date:To:CC:Resent-Date:Resent-From:Resent-To:Resent-Cc: In-Reply-To:References:Content-Type:Content-Disposition; b=kRpsaqMfuMod161AkEXa/hykEeh3e1PdVQ8CYi0B8r5JoxiZVRbbJ7l/I1c5jYxu/ 5S7JvP/r9llGHjYONOyMzmCurdLzi19oH2D7M5RznFHQ3fxV6gEXEqWS0n28jzO88r P27Oej/QO4NlvOxiDYgloFyJf4QJsut+2O1RgAvtjeaLNlZzYMHhh6st42vaiNuFOl PBFHT53G26fckI2Ch6m/WQYoC6Rr6EwHm2uLYpx/JmTi6Nu4JDrbfAG8ycb/MUPdpm AFiF7QDrZ9iFnTYsPBb6Drita4lr3lM42DFzj3qrVPVpuOtULc0rE1gMMfYq/1+EwW GePULiAKe+l40MDKyoJVRnWHpQCHOA6d+1L5X4A4egzdutvnQWyAfcENBCseQ74m6y yNqLVOIYJbePc2y5uDj+WAtPZSe5JgDQ2cutDm6okyCgJ0bIbeidfU31ju9rCUUCEH VjXO0DkJo62zZHr/07ZdR8mR+5Ripf3QxtCP9ktO33wGCS7tEFe From: "brian m. carlson" To: Cc: Jeff King , Duy Nguyen , Johannes Schindelin Subject: [PATCH 01/10] t: add helper to convert object IDs to paths Date: Sun, 9 Jun 2019 22:43:51 +0000 Message-Id: <20190609224400.41557-2-sandals@crustytoothpaste.net> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2 In-Reply-To: <20190609224400.41557-1-sandals@crustytoothpaste.net> References: <20190609224400.41557-1-sandals@crustytoothpaste.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 () {