Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

gitignore doesn't work if atom is opened within subdirectory of git repo #120

Open
aaronjensen opened this issue Jul 11, 2015 · 20 comments
Open

Comments

@aaronjensen
Copy link

I don't know if this is a fuzzy-finder or a core problem, but if I'm in a subdirectory of a git repo when I open atom the gitignore is... ignored.

@maaarghk
Copy link

See issue #111 - related?

@aaronjensen
Copy link
Author

hmm, related in that the two issues kinda seem at odds to each other. My problem is that the parent dir gitignore isn't used.

Example:

.gitignore:

node_modules

folder structure:

.gitignore
client
-- node_modules
server
-- node_modules

If I open atom client then node_modules is not ignored. If I open atom . then node_modules is ignored.

@manishtpatel
Copy link

+1, even adding .gitignore at client folder level does not help either.

@opensourceportfolio
Copy link

same issue here

@andykenward
Copy link

Having the same issue working in a sub directory of a repo that has its own .gitignore.
Changing to root of the repo solves the issue for me.

Atom 1.0.7

nielsAD added a commit to nielsAD/fuzzy-finder that referenced this issue Aug 25, 2015
nielsAD added a commit to nielsAD/fuzzy-finder that referenced this issue Aug 25, 2015
nielsAD added a commit to nielsAD/fuzzy-finder that referenced this issue Aug 25, 2015
@nielsAD
Copy link

nielsAD commented Aug 25, 2015

So this appears to be expected behaviour, according to the tests. I'm not sure if it's desired behaviour, though, as tree-view appears to flag the files as ignored.

@aaronjensen
Copy link
Author

I definitely do not desire it :)

@nielsAD
Copy link

nielsAD commented Aug 26, 2015

It looks like tree-view's "Hide VCS Ignored Files" setting has a similar behaviour; items are only hidden when you are actually working in the root of the VCS. Ignored files are still greyed out, though, when you are working in a subdirectory.

I'm not sure what the best solution would be... Maybe an extra setting? Or maybe the sorting should take ignored files into account and place them lower on the list? #133 is a PR that just disables the root folder check, so that would result in some inconsistencies between tree-view and fuzzy-finder.

@maaarghk
Copy link

Surely they would ideally both act in the same way which the relevant VCS works? An extra setting would be strange, it'd be an option to be inconsistent and therefore not useful. Inconsistencies between tree-view and fuzzy-finder are okay if one is wrong. Just means an issue needs to be raised on the incorrect module (this one, in my view)

@nielsAD
Copy link

nielsAD commented Aug 28, 2015

The best solution I can think of is that we let it depend on the working directory. If that one is ignored by the VCS, we do not use the VCS ignores and just display everything. Otherwise, we inherit the VCS ignores.

@maaarghk
Copy link

Sort of - a working directory which is itself .gitignored, but has its own .git folder (i.e. git submodule), should not process the parent .gitignore. It should use the .gitignore of the working directory (but not ignore it.)

@kemayo
Copy link

kemayo commented Nov 13, 2015

For another consistency point: find-in-project will respect the parent gitignore for this.

@kemayo
Copy link

kemayo commented Nov 13, 2015

#152 would, as a side-effect, make it super easy to either toggle this behavior or add an option for it.

@cappslock
Copy link

+1, this is a daily annoyance :(

@tjkohli
Copy link

tjkohli commented Nov 16, 2016

+1 This may be a duplicate of #252.

@brigand
Copy link

brigand commented Apr 5, 2017

I'm also running into this; any workarounds? I tried adding the directory to the root .gitignore and that didn't fix it.

@manishtpatel
Copy link

manishtpatel commented Apr 7, 2017 via email

@iofjuupasli
Copy link

describe("when the project's path is a subfolder of the repository's working directory", () => {
beforeEach(() => {
atom.project.setPaths([gitDirectory.resolve('dir')])
const ignoreFile = path.join(projectPath, '.gitignore')
fs.writeFileSync(ignoreFile, 'b.txt')
})
it('does not exclude paths that are git ignored', () => {
waitsForPromise(() => projectView.toggle())
runs(() => waitForPathsToDisplay(projectView))
runs(() => expect(Array.from(projectView.element.querySelectorAll('li')).find(a => a.textContent.includes('b.txt'))).toBeDefined())
})
})

;(
But why?

Workaround is to use "Ignored Names" setting

@awilkins
Copy link

awilkins commented Jun 8, 2018

Sorry to add noise to this ... but yes, it's a daily annoyance.

Both tree-view and fuzzy-finder (and nuclide-tree-view, which has it's own annoyance of not having an "ignored files" toggle) should all be singing from the same hymn sheet about which files are being shown, should be getting their file lists from a single service (if they aren't already) and that service should understand the VCS ignore rules with the same behaviour as the VCS.

Yes, you need a flag to not ignore things so you can find that stuff sometimes. tree-view has a toggle for this, it should probably set the flag on the aforementioned common file listing service, so when you fuzzy-find with tree ignore off, you get shown ignored files too.

@jaredh159
Copy link

I also find this behaviour unintuitive and frustrating.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests