Docs: git|ack -x as alternative to handling .gitignore
Specific example is
git ls-files * | ack3 --files-from=- string
which is even more awesome than either interpreting .gitignore or using find because it's looking exactly at the member files. Example edge case: if .gitignore was overridden with git add -f because this one ignorable file is indeed in the project, ack will see that one instead of ignoring it, this is good.
(It may result in ack3 looking at some .gif's though?)
I might add a git-ack shell script to my ~/bin to do exactly this ...
I have also used ack --output or cut to grab just the names of changed files from a git diff --stat to pipe into ack -x (and if i make git-ack, it will take a --diff flag to do that instead of ls-files )
(It may result in ack3 looking at some .gif's though?)
Yes, it would. If you feed ack files in -x, then it does no filtering on them.
someone pointed out that my perl/cut idiom ripping the filenames only from git diff --stat is silly, it's built in already:
git diff --name-only | ack -x -w create
Happy ... wish I'd seen it sooner ...
See also #40
Yes, it would. If you feed ack files in
-x, then it does no filtering on them.
Perhaps ack -x --perl or ack --files-from FN --no-json should filter as explicitly request.
(And if not, it really ought to error or at least warn that filter --perl is ignored with files specified by -x and likewise "on command line" "by --files-from" etc)
Being able to apply our named filters as a filter on a list of files would be a value-added feature.
Would this require a major re-arch because filtering is delegated to File::Next which we basically can't use with a provided list? (Unless File::Next got a new constructor that takes a --files-from or -x stream and uses that instead of tree walking ...)