ignore file, but only if in specific subdirectory?

I use intellij and my projects sync over multiple computers. I want to ignore the file workspace.xml, but only when it sits under an .idea directory.

It’s not that I regularly use files called workspace.xml so I could add it as just workspace.xml. Unfortunately, knowing myself, as soon as I would do that I’d end up with one of those somewhere else that won’t get synced.

Would .idea/workspace.xml work? I don’t see anything pointed in that direction.

Yes, it should.

Nice to hear. Might be a good idea to update the ignore docs with a small example of this?

Feel free to do that.

Really, this is described in the first patterns examples at Doc (foo). Reading it as “Spaces and path separator character are treated as regular characters” is the answer, because then you can’t define a narrowest exclude, i.e “This exact file in the whole root tree”, file being here dirname/basename. Why space is honoured by a specific sentence is another question, and any argue against would drive as an ultimate answer to a full list of regular characters (think about historical reasons and/or people that would add unrequired quotes around fi les, then making quotes special characters then requiring some escape syntax, when it is really not needed, at least at the moment). Rather, all special characters and mandatory/optionnal position in ignores list has its own special paragraph in the documentation.

Recently, an issue arose with #, then a ticket was opened, which will end either in a bugfix or doc notice.

Have a good day Steve.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.