summaryrefslogtreecommitdiff
path: root/t/lib-pager.sh
AgeCommit message (Collapse)Author
2010-06-21t/lib-pager.sh: remove unnecessary '^' from 'expr' regular expressionBrandon Casey
Regular expressions matched by 'expr' have an implicit '^' at the beginning of them and so are anchored to the beginning of the string. Using the '^' character to mean "match at the beginning", is redundant and could produce the wrong result if 'expr' implementations interpret the '^' as a literal '^'. Additionally, GNU expr 5.97 complains like this: expr: warning: unportable BRE: `^[a-z][a-z]*$': using `^' as the first character of the basic regular expression is not portable; it is being ignored Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-13grep: Add the option '--open-files-in-pager'Johannes Schindelin
This adds an option to open the matching files in the pager, and if the pager happens to be "less" (or "vi") and there is only one grep pattern, it also jumps to the first match right away. The short option was chose as '-O' to avoid clashes with GNU grep's options (as suggested by Junio). So, 'git grep -O abc' is a short form for 'less +/abc $(grep -l abc)' except that it works also with spaces in file names, and it does not start the pager if there was no matching file. [jn: rebased and added tests; with error handling fix from Junio squashed in] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>