[PATCH] t1006: skip %(rest) test for whitespace in object names
From: jyotish kumar <jyotishkumar725015@gmail.com>
---
t/t1006-cat-file.sh | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 72fc8acc61..47d9434bcc 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -183,21 +183,18 @@ $content"
test_cmp expect actual
'
- # FIXME: %(rest) is incompatible with object names that include whitespace,
- # e.g. HEAD:path/to/a/file with spaces. Use the resolved OID as input to
- # test this instead of the raw object name.
- if echo "$object_name" | grep -q " "; then
- test_rest=test_expect_failure
- else
- test_rest=test_expect_success
- fi
-
- $test_rest '--batch-check with %(rest)' '
- echo "$type this is some extra content" >expect &&
- echo "$object_name this is some extra content" |
- git cat-file --batch-check="%(objecttype) %(rest)" >actual &&
- test_cmp expect actual
- '
+ case "$object_name" in
+ *[[:space:]]*)
+ ;;
+ *)
+ test_expect_success '--batch-check with %(rest)' '
+ echo "$type this is some extra content" >expect &&
+ echo "$object_name this is some extra content" |
+ git cat-file --batch-check="%(objecttype) %(rest)" >actual &&
+ test_cmp expect actual
+ '
+ ;;
+ esac
test_expect_success '--batch-check with %(objectmode)' '
echo "$mode $oid" >expect &&
--
2.43.0