Fix for #2739 (and #1755), added support for directory excludes in the .gitignore file like /directory or directory/
Updated the regexp and added more test cases.
Updated the regexp and added an other test case for sub dirs
Merge pull request #2769 from sndpl/issue/2739

Fix for #2739 (and #1755), added support for directory excludes in the gitignore file