# gitignore: regex for the current dir files only?

2 messages from 2006-06-08 to 2006-06-08. Participants: Yasushi SHOJI, Junio C Hamano.
Thread: https://gitlist.dev/t/4429

## Yasushi SHOJI, 2006-06-08 02:13

Subject: gitignore: regex for the current dir files only?
Message-ID: <87mzcol7i3.wl@mail2.atmark-techno.com>
URL: https://gitlist.dev/e/87mzcol7i3.wl%40mail2.atmark-techno.com

```
Hello,

this problem came up when I was editing vmlinux.lds.S in the kernel
tree.

because we have "vmlinux*" in the toplevel .gitignore in linus's tree,
all vmlinux.lds.S under arch/$(ARCH)/kernel/ is affected. for kernel,
it might as easier to remove "*" from the exp.  but I was wandering if
it's worth to have an expression for gitignore to handle "a regex for
the current dir only"?

comments?
--
       yashi

```

## Junio C Hamano, 2006-06-08 02:40

Subject: Re: gitignore: regex for the current dir files only?
Message-ID: <7virnccquw.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7virnccquw.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <87mzcol7i3.wl@mail2.atmark-techno.com>

```
Yasushi SHOJI <yashi@atmark-techno.com> writes:

> because we have "vmlinux*" in the toplevel .gitignore in linus's tree,
> all vmlinux.lds.S under arch/$(ARCH)/kernel/ is affected. for kernel,
> it might as easier to remove "*" from the exp.  but I was wandering if
> it's worth to have an expression for gitignore to handle "a regex for
> the current dir only"?

Yeah, that would be a very useful thing to have.  Something like
this?

#!/bin/sh

rm -rf test
mkdir -p test/a/b/c
cd test
git init-db

date >a/vmlinux.1
date >a/b/vmlinux.2
date >a/b/c/vmlinux.3

echo 'vmlinux*' >a/.gitignore
echo '!/vmlinux*' >a/b/.gitignore

git status -u

```
