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>
This commit is contained in:
parent
773e25afc4
commit
8c891eed3a
@ -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) &&
|
||||
|
Loading…
Reference in New Issue
Block a user