aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Voss <thomas.voss@humanwave.nl> 2024-01-24 12:51:49 +0100
committerThomas Voss <thomas.voss@humanwave.nl> 2024-01-24 12:53:11 +0100
commitaa9f12ff8ea3fe215ef0a819cdd193e3088d9b86 (patch)
tree34650541f41f67b63c1a1f3f327ddd6792b83208 /src
parent1547077f958bec62f64674ac7c83e8f7f89b0cc9 (diff)
Find files via git-grep instead of git-ls-files
It would be preferable to use git-ls-files as it is more suited for our purposes, however git-grep allows us to filter out binary files. It makes no sense to regex match in a binary file, so this is crucial.
Diffstat (limited to 'src')
-rw-r--r--src/grab.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/grab.c b/src/grab.c
index 601d81e..300a787 100644
--- a/src/grab.c
+++ b/src/grab.c
@@ -804,7 +804,7 @@ getfstream(int argc, char *argv[argc])
case -1:
die("fork");
case 0:;
- size_t len = argc + 5;
+ size_t len = argc + 6;
char **args;
close(fds[FD_R]);
@@ -815,14 +815,15 @@ getfstream(int argc, char *argv[argc])
if (!(args = malloc(len * sizeof(char *))))
die("malloc");
args[0] = "git";
- args[1] = "ls-files";
- args[2] = "-z";
- args[3] = "--";
- memcpy(args + 4, argv, argc * sizeof(char *));
+ args[1] = "grep";
+ args[2] = "--cached";
+ args[3] = "-Ilz";
+ args[4] = "";
+ memcpy(args + 5, argv, argc * sizeof(char *));
args[len - 1] = nullptr;
execvp("git", args);
- die("execvp: git ls-files -z");
+ die("execvp: git grep --cached -Ilz ''");
}
close(fds[FD_W]);