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

request - trailing # comments are silently non-functional in .gitignore

From
JCJim Cromie <jim.cromie@gmail.com>
Date
May 5, 2008, 13:36 UTC
Message-ID
<481F0D58.50204@gmail.com>
perl is starting to use git, so Im a new user.

I wrote a script to generate .gitignore from a MANIFEST, so I used a universal ignore, followed by explicit *attends*

# ignore everything * # watch these files !perl.h ...

while testing this, I discovered that trailing comments silently invalidate the rule, so this line is ineffective:

*  # ignore everything. We attend to MANIFEST entries next...
Explicit MANIFEST support / file inclusion
    !<MANIFEST

the above could mean dont-ignore all files named in MANIFEST (1st field: /^(\S+)/)

This describes use of other .gitignores (but Im not suggesting this be supported)

    <`find . -name .gitignore`
However, this might be useful
    !<`cut -d\  -f2 MANIFEST-odd`
Id accept that this might be too much shell-ish magic for your tastes,
Preprocessor Support

Perl uses XS to interface to C libs etc, and needs to process foo.xs -> foo.c which is then compiled to make foo.o. Heres an excerpt from a makefile

# --- MakeMaker xs_c section:
.xs.c:
        $(XSUBPPRUN) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) 
$*.xs > $*.xsc && $(MV) $*.xsc $*.c

It would be nice if this kind of dependency were usable as an ignoral-directive, ignore foo.c if foo.xs exists.

some alternatives:
:*.c:*.xs:
    - colons signal different kind of line, and delimit 2 specs
    - the 2 * must match same literals (perhaps why make dev's left them 
out)
*.c!*.xs
    - here '!' serves as separator of 2 fields
    - also suggests attend to the 2nd field (which is arguably desirable)
       if so, it needs to be attended even if *.c is missing (it is 
until built)
Message 1 of 1 in “request - trailing # comments are silently non-functional in .gitignore”
  1. Jim CromieMay 5, 2008

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.