summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2021-02-10 18:01:29 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-02-10 12:38:00 -0800
commit8c891eed3a89ff945b7957cdf62037b2e2b6eca7 (patch)
tree244b393035edbf57f52da6683b9a334b889cdb6a
parentGit 2.30.1 (diff)
downloadtgif-8c891eed3a89ff945b7957cdf62037b2e2b6eca7.tar.xz
t1450: robustify `remove_object()`
This function can be simplified by using the `test_oid_to_path()` helper, which incidentally also makes it more robust by not relying on the exact file system layout of the loose object files. While at it, do not define those functions in a test case, it buys us nothing. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t1450-fsck.sh16
1 files changed, 6 insertions, 10 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index b17f5c21fb..0c58cb349b 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -40,17 +40,13 @@ test_expect_success 'HEAD is part of refs, valid objects appear valid' '
# specific corruption you test afterwards, lest a later test trip over
# it.
-test_expect_success 'setup: helpers for corruption tests' '
- sha1_file() {
- remainder=${1#??} &&
- firsttwo=${1%$remainder} &&
- echo ".git/objects/$firsttwo/$remainder"
- } &&
+sha1_file () {
+ git rev-parse --git-path objects/$(test_oid_to_path "$1")
+}
- remove_object() {
- rm "$(sha1_file "$1")"
- }
-'
+remove_object () {
+ rm "$(sha1_file "$1")"
+}
test_expect_success 'object with bad sha1' '
sha=$(echo blob | git hash-object -w --stdin) &&