DESCRIPTION

Log warnings about invalid RefSpecs in git config files

Handle invalid RefSpecs by catching the IllegalArgumentException that
JGit throws. Log the problem and otherwise ignore invalid RefSpecs.

Bug: 517314
Change-Id: Iea65dc0aeef31be9c9640f05d1cc413bcce23975
Signed-off-by: Alayna Houston xxx@xxx.xxx

COMMENTS

author: Alayna Houston
date: 2017-08-22 07:18:36.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2017-08-22 07:18:42.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/10103/

-------------------------------------
author: Alayna Houston
date: 2017-08-22 07:19:25.000000000

Patch Set 1:

Will not compile yet; depends on JGit change https://git.eclipse.org/r/#/c/103423/ .

-------------------------------------
author: Brenden Conley
date: 2017-08-22 07:20:19.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/egit/job/egit.gerrit/10103/ : FAILURE

-------------------------------------
author: Alayna Houston
date: 2017-08-22 07:40:31.000000000

Patch Set 1:

An additional improvement on this general mechanism in EGit might the following:

As is, EGit will simply log warnings to the Eclipse error log. A user may ignore these warnings. We could add a periodic background job that checks if there have been new such warnings since the last time it ran, and nag the user about it if so. If present, this nagging could perhaps be done via a Mylyn notification (the automatically disappearing info box that appears bottom right on the screen in newer Eclipses), otherwise we might consider that background job return a failure status. Would need to have a preference to set the nag interval (default maybe 5 minutes; user should be able to suppress nagging altogether), and maybe should nag only if the Error log is not set to activate on new entries (because if so, the user will be aware of the warnings already).

What do you think?

-------------------------------------
author: Douglas Trujillo
date: 2017-08-26 07:22:55.000000000

Patch Set 1: Code-Review-1

(1 comment)

Line:104, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/ReportingTypedConfigGetter.java -> shouldn't we call super.getRefSpecs() instead of reimplementing it here ?

 		try {
			return super.getRefSpecs(config, section, subsection, name);
		} catch (IllegalArgumentException e) {
			warn(config, join(section, subsection, name), null, e);
			return Collections.emptyList();
		}

-------------------------------------
author: Alayna Houston
date: 2017-08-26 09:21:47.000000000

Patch Set 1:

(1 comment)

Line:104, org.eclipse.egit.core/src/org/eclipse/egit/core/internal/ReportingTypedConfigGetter.java -> I don't think so. Consider a remote with multiple fetch refspecs, one of which is invalid. With your proposal, we'd ignore all of them, even the valid ones. If we re-implement the list building here, we can warn about the invalid ones but can still honor the valid ones.

I did think about adding a method to convert a single string to a RefSpec to TypedConfigGetter, but its interface would have been inconsistent with the other getters (would have been only "RefSpec getRefSpec(String value)", whereas all other Config getters take section, subsection, and name as parameters). In the end I preferred to have consistent method signatures in TypedConfigGetter and re-doing the list building here. It does duplicate some code, but it's trivial code and only a small duplication.

-------------------------------------
author: Brenden Conley
date: 2017-08-26 09:36:43.000000000

Patch Set 1: -Verified

Build Started https://ci.eclipse.org/egit/job/egit.gerrit/10110/

-------------------------------------
author: Brenden Conley
date: 2017-08-26 09:56:41.000000000

Patch Set 1: Verified+1

Build Successful 

https://ci.eclipse.org/egit/job/egit.gerrit/10110/ : SUCCESS

-------------------------------------
