Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359071

Summary: GitFileRevisions return an empty string for the author
Product: [Technology] EGit Reporter: Tomasz Zarna <tomasz.zarna>
Component: CoreAssignee: Robin Stocker <robin>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, markus.kell.r, matthias.sohn, remy.suen, robin.rosenberg, robin
Version: 1.1   
Target Milestone: 2.2-M1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Picture showing the issue
none
Picture of the two Compare editors
none
Picture showing opened compare editor from synchronize (working tree) none

Description Tomasz Zarna CLA 2011-09-27 10:04:47 EDT
Except for CommitFileRevision which returns an author stored in org.eclipse.jgit.lib.PersonIdent, all other GitFileRevisions (IndexFileRevision, WorkingTreeFileRevision, WorkspaceFileRevision) return an empty string when asked for the author.

See also bug 358392.
Comment 1 Dani Megert CLA 2011-09-28 04:23:22 EDT
This is a major loss of function when coming from CVS: one no longer sees immediately who made the (incoming) change.
Comment 2 Kevin Sawicki CLA 2011-11-29 19:37:45 EST
What should it be returning for [Index/WorkingTree/Workspace]FileRevision?

If I look at org.eclipse.team.core.history.provider.LocalFileRevision it also returns "".

Should it be null instead?
Comment 3 Dani Megert CLA 2011-11-30 02:40:22 EST
Created attachment 207703 [details]
Picture showing the issue
Comment 4 Dani Megert CLA 2011-11-30 02:40:50 EST
(In reply to comment #2)
> What should it be returning for [Index/WorkingTree/Workspace]FileRevision?
> 
> If I look at org.eclipse.team.core.history.provider.LocalFileRevision it also
> returns "".
> 
> Should it be null instead?

I can't comment on this bug, but it was my bug 358392 which triggered this one. it looks like "my bug" was simply to get rid of the NPE but not make the author appear. See attachment 207703 [details].
Comment 5 Dani Megert CLA 2011-11-30 02:42:16 EST
> it looks like "my bug" was simply to get rid of the NPE but not make the author
> appear.
What I meant, is that the other bug was fixed by suppressing the NPE only, instead of fixing the problem completely.
Comment 6 Robin Rosenberg CLA 2012-10-06 17:52:50 EDT
hmm, it's only the item that appear in a Git commit that has author information,
unless you consider the file owner, for which I'm not aware of an API.

For the workspace/index one could conceivably return the information from the  last commmit iff there are no local changes, otherwise I think it should be empty.

Kevins suggestion might be ok also. The null/emptyu string should be translated to "local user" or somethin in the UI.
Comment 7 Dani Megert CLA 2012-10-08 09:40:19 EDT
(In reply to comment #6)
> hmm, it's only the item that appear in a Git commit that has author
> information,
> unless you consider the file owner, for which I'm not aware of an API.

In my attached picture you can see the remote hash, so I assume there is a way to get that author.


> For the workspace/index one could conceivably return the information from
> the  last commmit iff there are no local changes, otherwise I think it
> should be empty.
> 
> Kevins suggestion might be ok also. The null/emptyu string should be
> translated to "local user" or somethin in the UI.

No, this adds no value. I know that I changed the file. What I'd like to see is the author of the revision that I changed (often this is the same as the one on the right side, but not always, e.g. if the file already changed on the remote master).
Comment 8 Matthias Sohn CLA 2012-10-22 02:49:41 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > hmm, it's only the item that appear in a Git commit that has author
> > information,
> > unless you consider the file owner, for which I'm not aware of an API.
> 
> In my attached picture you can see the remote hash, so I assume there is a
> way to get that author.

so you mean the right hand side of the compare editor which doesn't show the author but should show it? 

I tried this using "Compare With > HEAD revision" and EGit displays the author of the HEAD revision in the right hand pane of the compare editor. But the file displayed wasn't changed in the commit HEAD points at but in an earlier commit, but still EGit shows the author of HEAD commit which seems wrong since this isn't the author who last changed the file content displayed there.

Same behavior when my local change is staged and I double click it in the staging view. If it's not yet staged and I double click in "unstaged" pane of the staging view no author is displayed since then the right hand side represents the index state which has no author information on its own. Though as long as index and HEAD are identical we could show the author of the most recent commit who touched this file.
Comment 9 Robin Stocker CLA 2012-10-22 05:29:11 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > hmm, it's only the item that appear in a Git commit that has author
> > > information,
> > > unless you consider the file owner, for which I'm not aware of an API.
> > 
> > In my attached picture you can see the remote hash, so I assume there is a
> > way to get that author.
> 
> so you mean the right hand side of the compare editor which doesn't show the
> author but should show it? 
> 
> I tried this using "Compare With > HEAD revision" and EGit displays the
> author of the HEAD revision in the right hand pane of the compare editor.
> But the file displayed wasn't changed in the commit HEAD points at but in an
> earlier commit, but still EGit shows the author of HEAD commit which seems
> wrong since this isn't the author who last changed the file content
> displayed there.

Could you review https://git.eclipse.org/r/#/c/7690/ ? The behavior is fixed there (see commit message).
Comment 11 Dani Megert CLA 2012-10-29 11:24:48 EDT
Created attachment 222936 [details]
Picture of the two Compare editors
Comment 12 Dani Megert CLA 2012-10-29 11:25:41 EDT
This is still not fixed. I still do not see the author in the compare editor that is opened via Synchronize view.

It works if I do Compare With > Latest from HEAD on the same file. See attachment 222936 [details] to see the difference.
Comment 13 Dani Megert CLA 2012-10-29 11:28:11 EDT
(In reply to comment #12)
> This is still not fixed. I still do not see the author in the compare editor
> that is opened via Synchronize view.
> 
> It works if I do Compare With > Latest from HEAD on the same file. See
> attachment 222936 [details] to see the difference.

To clarify the picture: I would at least expect to see the author for the remote file in the left picture.
Comment 14 Robin Stocker CLA 2012-10-29 17:00:24 EDT
Could you please add the steps to reproduce this? I couldn't locate where "Remote File" is coming from and couldn't find it when using the Synchronize view.
Comment 15 Dani Megert CLA 2012-10-30 04:23:16 EDT
(In reply to comment #14)
> Could you please add the steps to reproduce this? I couldn't locate where
> "Remote File" is coming from and couldn't find it when using the Synchronize
> view.

1. Change a shared file and save it
2. Select its project in the 'Package Explorer'
3. Team > Synchronize with Workspace
4. in the 'Synchronize' view double-click the file
Comment 16 Robin Stocker CLA 2012-10-30 10:51:31 EDT
Created attachment 222985 [details]
Picture showing opened compare editor from synchronize (working tree)

With these steps I get the attached result. The file is from below the <working tree> node, Eclipse 4.2.1.

When I stage it and then open the compare editor, I get an NPE (the fix for that is in https://git.eclipse.org/r/#/c/7564/).

Different settings?
Comment 17 Dani Megert CLA 2012-10-30 11:00:12 EDT
(In reply to comment #16)
> Created attachment 222985 [details]
> Picture showing opened compare editor from synchronize (working tree)
> 
> With these steps I get the attached result. The file is from below the
> <working tree> node, Eclipse 4.2.1.
> 
> When I stage it and then open the compare editor, I get an NPE (the fix for
> that is in https://git.eclipse.org/r/#/c/7564/).
> 
> Different settings?

I don't know what you mean by working tree. Looks like more detailed steps from me are needed (I thought they should work).
Comment 18 Robin Stocker CLA 2012-10-30 11:06:22 EDT
(In reply to comment #17)
> I don't know what you mean by working tree. Looks like more detailed steps
> from me are needed (I thought they should work).

Ah, now I found it! I had "Git Commits" as the selected model. With that, the root nodes are <working tree>, <staged changes> and then individual commits. When switching to "Workspace", I can now reproduce the compare editor with "Remote File" and no author.
Comment 19 Robin Stocker CLA 2012-10-30 11:28:43 EDT
Found the place thanks to EclEmma (coverage of running Eclipse), fix pushed to review:

https://git.eclipse.org/r/8421
Comment 20 Dani Megert CLA 2012-10-30 11:40:27 EDT
(In reply to comment #19)
> Found the place thanks to EclEmma (coverage of running Eclipse), fix pushed
> to review:
> 
> https://git.eclipse.org/r/8421

Submitted as http://git.eclipse.org/c/egit/egit.git/commit/?id=b63344fc5727ecaf78de16f16bb5cc5f243bab48
Comment 21 Robin Stocker CLA 2012-10-30 12:10:53 EDT
Failing tests caused by the change:

https://hudson.eclipse.org/sandbox/job/egit.gerrit/3507/
Comment 22 Robin Stocker CLA 2012-10-30 12:19:40 EDT
(In reply to comment #21)
> Failing tests caused by the change:
> 
> https://hudson.eclipse.org/sandbox/job/egit.gerrit/3507/

Fix pushed:

https://git.eclipse.org/r/8423
Comment 24 Dani Megert CLA 2012-10-31 04:38:06 EDT
Verified in 2.2.0.201210310023