DESCRIPTION

Add ICommitMessageProvider2 for caret positioning in commit messages

The caret in the CommitMessageComponent is placed according to the
value of getDesiredCaretPosition() of the first implementation of
ICommitMessageProvider2 that provides caret position. In case there
are multiple implementations available that provide a defined caret
position the second and subsequent positions are ignored.

Commit messages are not trimmed anymore to ensure consistency between
a provided message and the provided caret position.

Includes unit and UI tests.

Bug: 516867
Change-Id: I1b0ffd33ef37196d53077d09774672c2b033835f
Signed-off-by: James Mcgee xxx@xxx.xxx
Signed-off-by: Alayna Houston xxx@xxx.xxx

COMMENTS

author: James Mcgee
date: 2017-06-16 10:41:36.000000000

Uploaded patch set 21.

-------------------------------------
author: Brenden Conley
date: 2017-06-16 10:41:42.000000000

Patch Set 21:

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

-------------------------------------
author: Alayna Houston
date: 2017-06-16 11:06:07.000000000

Patch Set 21:

(6 comments)

Line:21, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/CommitMessageComponentTest.java -> Let's call this class CommitMessageProvidersTest then; having two classes with the same name in two different packages is just confusing.

Line:24, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculatorTest.java -> With the rename, this should be called CommitMessageBuilderTest.

Line:28, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageCalculatorTest.java -> And this should be commitMessageBuilder = newCommitMessageBuilder(...) throughout.

Line:1, org.eclipse.egit.ui/src/org/eclipse/egit/ui/CommitMessageWithCaretPosition.java -> Missing license header.

Line:11, org.eclipse.egit.ui/src/org/eclipse/egit/ui/CommitMessageWithCaretPosition.java -> Missing period.

-------------------------------------
author: Brenden Conley
date: 2017-06-16 11:06:24.000000000

Patch Set 21: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/9939/ : UNSTABLE

-------------------------------------
author: Douglas Trujillo
date: 2017-06-16 22:41:16.000000000

Patch Set 21:

(3 comments)

Line:58, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> file paths

Line:61, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> paths ?

Line:207, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> This second variable with the same value seems to be unnecessary

-------------------------------------
author: Alayna Houston
date: 2017-06-16 22:57:05.000000000

Patch Set 21:

(4 comments)

Line:47, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Remove this field.

Line:64, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Remove this line

Line:79, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> getCommitMessageProviders()

Line:207, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> I think it was introduced to get around null warnings.

@Stefan: but it's not needed indeed; instead annotate the parameter in the constructor and the field with @NonNull (using org.eclipse.jgit.annotations.NonNull) so that the type is xxx@xxx.xxx Repository". Then you don't need this variable or its null comparisons.

-------------------------------------
author: James Mcgee
date: 2017-06-19 07:39:27.000000000

MISMATCHED INLINE COMMENT
Line:47, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Done

-------------------------------------
author: James Mcgee
date: 2017-06-19 07:39:27.000000000

MISMATCHED INLINE COMMENT
Line:58, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Done

-------------------------------------
author: James Mcgee
date: 2017-06-19 07:39:27.000000000

MISMATCHED INLINE COMMENT
Line:61, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> filesToCommit is from the original code. 
Done.

-------------------------------------
author: James Mcgee
date: 2017-06-19 07:39:27.000000000

MISMATCHED INLINE COMMENT
Line:64, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Done

-------------------------------------
author: James Mcgee
date: 2017-06-19 07:39:27.000000000

MISMATCHED INLINE COMMENT
Line:79, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Done

-------------------------------------
author: James Mcgee
date: 2017-06-19 07:39:27.000000000

MISMATCHED INLINE COMMENT
Line:207, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Ah, thanks! Wasn't familiar with the usage xxx@xxx.xxx

-------------------------------------
author: Alayna Houston
date: 2017-06-19 09:54:07.000000000

MISMATCHED INLINE COMMENT
Line:218, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> Give it a repository :-) Make CommitMessageBuilderTest extend GitTestCase, xxx@xxx.xxx from e.g. AddOperationTest, and pass in newCommitMessageBuilder testRepository.getRepository().

-------------------------------------
author: James Mcgee
date: 2017-06-19 07:39:27.000000000

MISMATCHED INLINE COMMENT
Line:218, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitMessageBuilder.java -> I removed this null check, since repository is non-null by definition now.
CommitMessageBuilderTest currently passes null. Tests now fail with NPE. I would like to mock this method, but I can't use mocking (https://bugs.eclipse.org/bugs/show_bug.cgi?id=349164).

Do you have any suggestions?
My only idea: pass a mock of Repository.class, which mocks all methods needed in ProjectUtil.getProjects(repository);

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