threads / discuss / 13385

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

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

## tl;dr

One message between May 5, 2008 and May 5, 2008.

replies: 0people: 1as markdown or json

Jim Cromie· May 5, 2008, 13:36 UTC · lore
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)

← back to recent threads