summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-07-22 11:24:11 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-07-22 11:24:11 -0700
commit988f98f61fc80021311c2d161084c03a55f7354d (patch)
treeb38485fc5a6b4e4fd70c37cf93e76cdeaae6a6b8 /builtin/grep.c
parentMerge branch 'hv/config-from-blob' (diff)
parenttest: run testcases with POSIX absolute paths on Windows (diff)
downloadtgif-988f98f61fc80021311c2d161084c03a55f7354d.tar.xz
Merge branch 'jx/clean-interactive'
Add "interactive" mode to "git clean". The early part to refactor relative path related helper functions looked sensible. * jx/clean-interactive: test: run testcases with POSIX absolute paths on Windows test: add t7301 for git-clean--interactive git-clean: add documentation for interactive git-clean git-clean: add ask each interactive action git-clean: add select by numbers interactive action git-clean: add filter by pattern interactive action git-clean: use a git-add-interactive compatible UI git-clean: add colors to interactive git-clean git-clean: show items of del_list in columns git-clean: add support for -i/--interactive git-clean: refactor git-clean into two phases write_name{_quoted_relative,}(): remove redundant parameters quote_path_relative(): remove redundant parameter quote.c: substitute path_relative with relative_path path.c: refactor relative_path(), not only strip prefix test: add test cases for relative_path
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 0223d701a6..d3b3b1db11 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -286,8 +286,7 @@ static int grep_sha1(struct grep_opt *opt, const unsigned char *sha1,
struct strbuf pathbuf = STRBUF_INIT;
if (opt->relative && opt->prefix_length) {
- quote_path_relative(filename + tree_name_len, -1, &pathbuf,
- opt->prefix);
+ quote_path_relative(filename + tree_name_len, opt->prefix, &pathbuf);
strbuf_insert(&pathbuf, 0, filename, tree_name_len);
} else {
strbuf_addstr(&pathbuf, filename);
@@ -318,7 +317,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
struct strbuf buf = STRBUF_INIT;
if (opt->relative && opt->prefix_length)
- quote_path_relative(filename, -1, &buf, opt->prefix);
+ quote_path_relative(filename, opt->prefix, &buf);
else
strbuf_addstr(&buf, filename);