LPS-34649 Generate the .gitignore file only if we need something to exclude