atom / fuzzy-finder

Find and open files quickly
MIT License
276 stars 138 forks source link

gitignore: negations of previously excluded patterns not working #65

Open Oblongmana opened 9 years ago

Oblongmana commented 9 years ago

Environment

OS: OSX Yosemite (10.10.1) Atom Version: 0.123.0

Repro Setup

Set up a directory structure src/classes in your project root, and create a file in there called Batch_UpdateMatchingProducts.cls

Ignore the src/classes folder using a glob in your gitignore.

src/classes/*

Add a negation rule in your gitignore - that will include a single file that was excluded by the previous rule called "Batch_UpdateMatchingProducts.cls"

src/classes/*
!src/classes/Batch_UpdateMatchingProducts.cls*

Issue

Attempt to open the file using the fuzzy-finder file finder (OSX: cmd+p or cmd+t) by typing "Batch_UpdateMatchingProducts" - and observe that the file does not show up in the list

Image demonstrating error

Expected Behaviour

As indicated in the git documentation (https://www.kernel.org/pub/software/scm/git/docs/gitignore.html#_pattern_format) - negation will include a pattern that was previously excluded. As such, I would expect fuzzy-finder to include the file Batch_UpdateMatchingProducts.cls in the search list.

Other notes

Possible this is "working as intended" - as the flag for this strictly says to excludeVcsIgnoredPaths - and the path is excluded - but then re-included. Also possible that this may be an issue in an underlying library?

enguerran commented 9 years ago

It seems related to https://github.com/atom/tree-view/issues/196, doesn't it?

ghost commented 9 years ago

Yes, I think it is. If the tree view doesn't track the files then fuzzy finders (and find in project too) will not work for them...

Maybe you could try that :

!/src/classes
/src/classes/*
!/src/classes/Batch_UpdateMatchingProducts.cls*
mrvisser commented 9 years ago

Here's my .gitignore:

.DS_STORE
/dump.rdb
/target/
*.log
doc_data.txt

/node_modules/*
!/node_modules/oae-*
!/node_modules/oae-*/*
/node_modules/oae-release-tools
/node_modules/oae-rest

It appears the file list doesn't indicate that a file such as timezones.json is being ignored:

image

However fuzzy-search won't find the file:

image

My config:

"*":
  "exception-reporting":
    userId: "not sure if private...."
  welcome:
    showOnStartup: false
  core: {}
  editor:
    invisibles: {}

Atom 1.0.14 / Mac OSX 10.10.5

ghost commented 9 years ago

Try to add : !/node_modules before : /node_modules/*

It changes nothing for git but seems to resolve issues with atom tree-view and fuzzy finder.

jfrazier commented 9 years ago

I was having the same issue, where the negated file ignore entries (using !) were not being picked up by fuzzy finder or in the tree view. Using the work around that @KevinHivert suggested fixes the issue.

Original: node_modules !src/node_modules

changed it to: !src/node_modules node_modules/*

Clue: I changed my original to:

node_modules !src/node_modules

to:

node_modules/* !src/nodemodules

and it shows up as not grayed-out in tree view, but does not show up in the fuzzyfinder

rossburton commented 8 years ago

I'm still hitting this. It appears that libgit2 was fixed so the tree view shows files in negated directories, but I still can't open them using fuzzy-finder.

dead-claudia commented 8 years ago

I'm still hitting this, too.

matthewberryman commented 7 years ago

Still hitting this in the fuzzy finder Still in 1.18.0

$ atom --version
Atom    : 1.18.0
Electron: 1.3.15
Chrome  : 52.0.2743.82
Node    : 6.5.0

Lines from .gitignore (private repo so can't share it in full):

*.xcodeproj/*
!*.xcodeproj/project.pbxproj
rossburton commented 7 years ago

Same here, 1.18.0 on macOS.

Selected lines from gitignore:

meta-*/
!meta-skeleton
!meta-selftest
!meta-poky
!meta-yocto
!meta-yocto-bsp

I can't see any files in meta-poky/ in the finder or tree view.

prantlf commented 4 years ago

As @KevinHivert and @mrvisser showed in their examples, if you exclude a whole directory and then try to include a file from it, it will not work:

dist
!dist/index.d.ts

Negation of the previous exclusion works only on the same directory level. You have to exclude all content of the directory and then include only some content of the directory:

dist/*
!dist/index.d.ts

The example above allows you to build dist/index.js and dist/index.mjs and their sourcemaps next to dist/index.d.ts, which only the last one you want to commit.

Or you try harder to avoid negative patterns :-)

dist/*.[jm]*