Re: Odd .gitignore behaviour

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

 



Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:

[...]

> So what you describe sounds wrong.
>
> But my quick test didn't actually support the behaviour you see. In this 
> situation:
>
> 	[torvalds@woody git-test]$ cat .gitignore
> 	a*
> 	[torvalds@woody git-test]$ cat subdir/.gitignore
> 	!a-ok
> 	[torvalds@woody git-test]$ find *
> 	all-files
> 	subdir
> 	subdir/a-ok
> 	[torvalds@woody git-test]$ git ls-files -o --exclude-per-directory=.gitignore
> 	.gitignore
> 	subdir/.gitignore
> 	subdir/a-ok
>
> ie we *do* show "showdir/a-ok" (but we don't show "all-files") because 
> a-ok is explicitly marked to be not ignored by a higher-priority rule.

OK, and if I say "git add subdir/a-ok" I get no error, as expected.

So extend it just a tiny bit, moving a-ok down a directory and using
the negative pattern "!subsubdir/a-ok" to match:

    brs% cat .gitignore
    a*
    brs% cat subdir/.gitignore
    !subsubdir/a-ok
    brs% find *
    all-files
    subdir
    subdir/.gitignore
    subdir/subsubdir
    subdir/subsubdir/a-ok
    subdir/a-ok
    brs% git ls-files -o --exclude-per-directory=.gitignore
    .gitignore
    subdir/.gitignore
    subdir/subsubdir/a-ok
    brs% git add subdir/subsubdir/a-ok
    The following paths are ignored by one of your .gitignore files:
    subdir/subsubdir/a-ok
    Use -f if you really want to add them.
    fatal: no files added

So I think the output from git-ls-files is as expected (as I interpret
the manpage and your explanation).  So is git-add just using some
different code?

[...]

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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