DESCRIPTION

Fixes compare input for local changes nodes.

GitModelBlob class was using compare() and hashCode() methods
implementation from GitModelCommit, therefore in some cases Compare View
was showing wrong files in comparison. It also fixes wrong headers in the
compare editor.

Bug: 326674
Change-Id: If42607deca500f3439c512382af0b13b01b90b3d
Signed-off-by: Leslie Stephenson xxx@xxx.xxx


COMMENTS

author: Leslie Stephenson
date: 2010-11-26 23:56:26.000000000

Uploaded patch set 3.

-------------------------------------
author: Carlie Harper
date: 2010-11-29 14:27:08.000000000

Patch Set 3: I would prefer that you didn't submit this

(4 inline comments)

Please see my inline comments.

Line:116, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java -> Unintended reformatting

Line:378, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java -> This code does not work if a file is checked-in and is changed in the working dir, but not in the index. Then the method isCachedEntry  returns false and as a consequence later on the comparison is done with the base commit, which is the parent of head.

If a file is in head and has no staged changes then it **is** in the index and GitFileRevision.inIndex(db, gitPath) returns a meaningful value. We should do the same here as in CompareWithIndexActionHandler. There the method getHeadTypedElement does a check if the file exists in the index. If not, it returns a GitCompareFileRevisionEditorInput.EmptyTypedElement with the text "{0} not in index", if yes, it uses GitFileRevision.inIndex.

Line:397, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java -> The method name does not describe what the method it is doing. 

In general it simply compares if the entries of two different trees are equal, right? But don't you just want to know there is an entry in the index for this file? Why do you have to check if the entry in the index  is different from the entry in head?

Line:745, org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties -> In Compare With Index and the corresponding compare edior we use the term "Index", in the node of the synchronize view we use "Staged".

To be consistent I would say that we should use "staged version" here.

-------------------------------------
author: Leslie Stephenson
date: 2010-11-29 22:42:07.000000000

Patch Set 3: (4 inline comments)



Line:116, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java -> Done

Line:378, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java -> In my humble opinion this is proper behavior. When you have locally changed file (and you didn't stage any changes for it before) it should compare against latest commit not version in cache/index, because it does "not exists".

The behavior that you proposed can be miss leading for end user.

Line:397, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CompareUtils.java -> I'll rename it (or remove it) when we agree on what we should show in right hand side editor in compare view, wen we are comparing locally changed file that doesn't have staged changes.

Line:745, org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties -> Done

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