]> git.phdru.name Git - git-wiki.git/blobdiff - pep-git.txt
``git grep`` doesn't pass pattern if pager is not ``less``
[git-wiki.git] / pep-git.txt
index 80d2a8466fae3bf762b14175aee56c3131ff8d4e..968aa329d2f85ba9232ec2e37b3054a6f9af37c6 100644 (file)
@@ -784,9 +784,16 @@ but you can use your editor::
 
     $ git grep -Ovim # but not -O vim
 
-BTW, there is a difference between running ``git grep -O`` and ``git
-grep -Oless`` - in the latter case ``git grep`` passes ``+/pattern``
-option to ``less``.
+BTW, if git is instructed to use ``less`` as the pager (i.e., if pager
+is not configured in git at all it uses ``less`` by default, or if it
+gets ``less`` from GIT_PAGER or PAGER environment variables, or if it
+was configured with ``git config --global core.pager less``, or
+``less`` is used in the command ``git grep -Oless``) ``git grep``
+passes ``+/$pattern`` option to ``less`` which is quite convenient.
+Unfortunately, ``git grep`` doesn't pass the pattern if the pager is
+not exactly ``less``, even if it's ``less`` with parameters (something
+like ``git config --global core.pager less -FRSXgimq``); fortunately,
+``git grep -Oless`` always passes the pattern.
 
 
 bash/zsh completion