Age | Commit message (Collapse) | Author | Files | Lines |
|
test_config() is already a well-defined function in
test-lib-functions.sh. Don't duplicate it unnecessarily.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
Gettextize the "--open-files-in-pager only works on the worktree"
message. A test in t7811-grep-open.sh explicitly checked for this
message. Change it to skip under GETTEXT_POISON=YesPlease.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
With a .gitconfig like this:
[color]
ui = auto
[color "grep"]
filename = magenta
if stdout is a terminal, the grep machinery will output the color
sequence \e[36m before each filename in its output.
In the case of "git grep -O foo", output is argv for the pager.
Disable color when calling the grep machinery in this case.
Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
The fake "less" script was already created in a previous test titled
'setup: fake "less"', so it is redundant. Additionally, it is broken since
the redirection of 'cat' is to a file named 'less', but the chmod operates
on the file named by the $less variable which may not contain the value
'less'.
So, just remove this code, and rely on the creation of the fake "less"
script performed earlier within the test script.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
The fake "less" script was not being made executable. This can cause the
tests that follow to fail. This failure is not apparent on platforms which
have DEFAULT_PAGER set to the string "less", since lib-pager.sh will have
set the $less variable to "less" and the SIMPLEPAGER prerequisite will have
been set, and so the "less" script will have already been created properly
and made executable in test 2 'git grep -O'. On platforms which set
DEFAULT_PAGER to something like "more", no such script will have been
previously created, and tests 7 and 8 will fail.
So, add a call to chmod to make the fake "less" script executable.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
Suppose you want to edit all files that contain a specific search term.
Of course, you can do something totally trivial such as
git grep -z -e <term> | xargs -0r vi +/<term>
but maybe you are happy that the same will be achieved by
git grep -Ovi <term>
now.
[jn: rebased and added tests]
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
|
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>
|