clone 556584 -1 -2
retitle -1 ls-files(1) doesn’t explain which files exclude patterns apply to
retitle -2 ls-files(1): document that filename arguments are glob patterns
severity -1 minor
severity -2 minor
retitle 556584 git-ls-files: exclude patterns don’t affect tracked files
severity 556584 wishlist
tags 556584 + wontfix
thanks
Hi Christian,
Christian Ohm wrote:
> if [ -d .git ] ; then
> git ls-files | sort | cscope -R -b -i- -f"$PROJDIR"/cscope.out
> else
> (
> cd /;
> find "$PROJDIR" -name '\.git' -name '\.svn' -name '\.hg' -prune -o -name
> \*.c -o -name \*.h -o -name \*.l -o -name \*.y -o -name \*.cpp -o -name \*.cc
> |
> sort |
> cscope -R -b -i- -f"$PROJDIR"/cscope.out
> )
> fi
>
> That works, and the git ls-files line is much more convenient than the find
> below, since it lists only the tracked files, not anything else.
>
> But I'd also like to exclude the data files, since they take unneccessary time
> to process, and occasionally lead to false positives. So I looked at the
> git-ls-files man page, and saw the exclude options, which looked exactly like
> what I wanted: "show me all files in the repo, except the following."
Hmm, in this case it might be easier to phrase the match positively:
git ls-files -- \*.c \*.h \*.l \*.y \*.cpp \*.cc \*.tcc |
sort |
cscope -R -b -i- -f"$PROJDIR"/cscope.out
So here’s another documentation bug: nowhere in the git-ls-files man page
does it explain that the filenames it takes are glob patterns.
(If you want to take patterns from a file, the shell makes this a little
trickier than I would like. At least
<.cscope-files xargs -d "\n" git ls-files --
works as expected.)
> Of course, I can just filter out unwanted files with grep or something, but
> the -X option would have made it very easy to just have a project-specific
> .cscope-ignore file that I can just feed to git ls-files.
Right. The -X option is already used by some commands (e.g., git-gui) to
support .gitignore, so I do not think it can be used for this. I am not
sure whether adding an option that can be used would be worth the
complication, but if you have some idea of how this should work, you or I
could try sending a patch.
Thanks for the explanation.
Best wishes,
Jonathan
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]