Start new rule with \n if ignore file exists but not in the workspace
commit89731f49ae33b7b1526ce16b91f1cb2008193c1c
authorAndrey Loskutov <loskutov@gmx.de>
Wed, 18 Nov 2015 22:28:40 +0000 (18 23:28 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 18 Nov 2015 23:50:28 +0000 (19 00:50 +0100)
treec1d56817001e2d86cb3ecad5df2de503dd986b16
parent76ecb3d010e3a4019bd43f43dd50588f31ff5195
Start new rule with \n if ignore file exists but not in the workspace

The best example I've seen why the code should never ever use
conditional expressions without curly braces. The missing braces and
wrong else block indentation suggested that the "ignoreLine" should be
prepended with a new line in case the file already exists and does not
ends with a new line. The reality was that the "else" block was
following not the first but the second "if", and so the code never did
what requested and ignore file was corrupted with a new ignore rule
added on the same line as the last ignore rule. OMG!

To reproduce, create an ignore file which ends with an ignore rule
without terminating new line. Make sure the files to ignore are outside
the workspace and try to ignore them from the repositories view.

Change-Id: I41631c6b2fd1557024c4d83a8f4f4fc89ecadfe7
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
org.eclipse.egit.core/src/org/eclipse/egit/core/op/IgnoreOperation.java