Handling entry into .gitignore

In cases where the last line of the .gitignore is a non-empty line,
this patch ensures that the injected entry isn't concatonated with the
non-empty line.