git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] extending git-ls-files --exclude.

From
MCMarco Costalba <mcostalba@yahoo.it>
Date
Jul 25, 2005, 06:41 UTC
Message-ID
<20050725064140.95259.qmail@web26304.mail.ukl.yahoo.com>
Junio C Hamano wrote:
Show 14 quoted lines
>The list of patterns that is in effect at a given time is
>built and ordered in the following way:
>
> * --exclude=<pattern> and lines read from --exclude-from=<file>
>   come at the beginning of the list of patterns, in the order
>   given on the command line.  Patterns that come from the file
>   specified with --exclude-from are ordered in the same order
>   as they appear in the file.
>
> * When --exclude-per-directory=<name> is specified, upon
>   entering a directory that has such a file, its contents are
>   appended at the end of the current "list of patterns".  They
>   are popped off when leaving the directory.
>

Are really necessary to have both --exclude-from=<file> and --exclude-per-directory=<name> ?

Peraphs, if the file name of excluded list is the same for each directory, e.g. .gitignore or something similar, instead of --exclude-per-directory we can use a concept of file validity 'scope' and just use --exclude-from=<file>. If entering in a directory <file> is found its contents are appended and removed when leaving directory. A bad analogy can be with the use of recursive Makefile.

Show 7 quoted lines
>
>A pattern specified on the command line with --exclude or read
>from the file specified with --exclude-from is relative to the
>top of the directory tree.  A pattern read from a file specified
>by --exclude-per-directory is relative to the directory that the
>pattern file appears in.
>

If we use the 'scope' logic we can just prepend path when adding entries and serach with with FNM_PATHNAME flag.

Show 12 quoted lines
> - if it does not contain a slash '/', it is a shell glob
>   pattern and used to match against the filename without
>   leading directories (i.e. the same way as the current
>   implementation).
>
> - otherwise, it is a shell glob pattern, suitable for
>   consumption by fnmatch(3) with FNM_PATHNAME flag.  I.e. a
>   slash in the pattern must match a slash in the pathname.
>   "Documentation/*.html" matches "Documentation/git.html" but
>   not "ppc/ppc.html".  As a natural exception, "/*.c" matches
>   "cat-file.c" but not "mozilla-sha1/sha1.c".
>

Same comment as above, if prepending path when adding per directory contents we can simplify to always use FNM_PATHNAME flag.

We don't have even to special case base directory global scope <file> if we use realtive paths so that we prepend its contents with ./ and we have what we expect.

I am sorry to not be able to send a patch, better explaining what proposed but I am just leaving today and I will be off line for a couple of weeks.

Marco

__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Next: Junio C Hamano
Message 1 of 3 in “Re: [RFC] extending git-ls-files --exclude.”
  1. Marco CostalbaJul 25, 2005
  2. Junio C HamanoJul 25, 2005
  3. Junio C HamanoJul 25, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.