Merge branch 'ds/reachable'
[gitweb.git] / t / t7810-grep.sh
index c82c8f5f728d1fc912f8bfd9819acf9f1b5dd1b2..be5c1bd553ede55d54e1d918625c99000ba32d80 100755 (executable)
@@ -259,6 +259,21 @@ do
                fi
        '
 
+       test_expect_success "grep $L (with --column, --only-matching)" '
+               {
+                       echo ${HC}file:1:5:mmap
+                       echo ${HC}file:2:5:mmap
+                       echo ${HC}file:3:5:mmap
+                       echo ${HC}file:3:13:mmap
+                       echo ${HC}file:4:5:mmap
+                       echo ${HC}file:4:13:mmap
+                       echo ${HC}file:5:5:mmap
+                       echo ${HC}file:5:13:mmap
+               } >expected &&
+               git grep --column -n -o -e mmap $H >actual &&
+               test_cmp expected actual
+       '
+
        test_expect_success "grep $L (t-1)" '
                echo "${HC}t/t:1:test" >expected &&
                git grep -n -e test $H >actual &&
@@ -932,10 +947,9 @@ test_expect_success 'grep from a subdirectory to search wider area (1)' '
 test_expect_success 'grep from a subdirectory to search wider area (2)' '
        mkdir -p s &&
        (
-               cd s || exit 1
-               ( git grep xxyyzz .. >out ; echo $? >status )
-               test_must_be_empty out &&
-               test 1 = $(cat status)
+               cd s &&
+               test_expect_code 1 git grep xxyyzz .. >out &&
+               test_must_be_empty out
        )
 '