Re: [bug] git-ls-files sometimes does not list files with pathspec magic ":(exclude)"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 13, 2021 at 06:07:56PM -0800, Junio C Hamano wrote:

> The rule IIUC is that a path must match one of the positive pathspec
> and none of the negative pathspec, but it looks as if there is some
> bogus optimization based on string length.

I dug a little on this earlier this morning, but didn't get far enough
to have any confidence that I wasn't barking totally up the wrong tree.
But I found the way the "prefix" is passed match_pathspec to be
confusing. This seems to make the problem go away:

diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index c8eae899b8..93796404bd 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -232,7 +232,7 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
 	    is_submodule_active(repo, ce->name)) {
 		show_submodule(repo, dir, ce->name);
 	} else if (match_pathspec(repo->index, &pathspec, fullname, strlen(fullname),
-				  max_prefix_len, ps_matched,
+				  0, ps_matched,
 				  S_ISDIR(ce->ce_mode) ||
 				  S_ISGITLINK(ce->ce_mode))) {
 		tag = get_tag(ce, tag);

which I guess is likewise disabling the same optimization you're talking
about. But that probably means the bug is in match_pathspec().

(I probably won't look further at this for a while, so please continue
your prodding; I just wanted to drop what little knowledge I came up
with).

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux