Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341428 - RepositoryUtil.mapCommitToRef() not testing tags properly
Summary: RepositoryUtil.mapCommitToRef() not testing tags properly
Status: CLOSED DUPLICATE of bug 337967
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-30 17:47 EDT by François Rey CLA
Modified: 2011-06-08 05:47 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description François Rey CLA 2011-03-30 17:47:28 EDT
Build Identifier: 0.11.3

In org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
Function mapCommitToRef
 148    } else if (any instanceof RevCommit) {
 149        RevCommit commit = ((RevCommit)any);
 150        tagMap.put(tagRef.getName(), commit.getCommitterIdent().getWhen());
 151    } // else ignore here
The above code snippet does not test if the found commit is equal to the given revision. Actual code should read:
        } else if (any instanceof RevCommit) {
            RevCommit commit = ((RevCommit)any);
            if (commit.toObjectId().name().equals(commitId)) {
                Date timestamp = commit.getCommitterIdent().getWhen()
                tagMap.put(tagRef.getName(), timestamp);
                Logger.debug "    mapCommitToRemoteRef: found tag ${tagRef} = ${any}(RevCommit) at ${timestamp?.dateTimeString}"
            }
        } // else ignore here

I've successfully used this fix in my own groovy script.


Reproducible: Always
Comment 1 François Rey CLA 2011-03-30 17:50:14 EDT
Code provided above was my custom groovy code.
Here's how the fix should look like in java


        } else if (any instanceof RevCommit) {
            RevCommit commit = ((RevCommit)any);
            if (commit.toObjectId().name().equals(commitId)) {
                RevCommit commit = ((RevCommit)any);
                tagMap.put(tagRef.getName(), commit.getCommitterIdent().getWhen());
            }
        } // else ignore here
Comment 2 Matthias Sohn CLA 2011-03-31 05:15:07 EDT
Could you contribute your patch in our Gerrit code review server as described in the contributor guide [1] ?

[1] http://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches
Comment 3 François Rey CLA 2011-03-31 09:56:27 EDT
May I ask an existing egit developper to please do that instead?
It would be easier overall because I have not setup my environment for egit development. I only copied part of the code form egit source plugin into my own groovy code, and fixed the bug in my own groovy project.
Comment 4 Matthias Sohn CLA 2011-03-31 10:19:37 EDT
Ok, I can do that for you, could you please confirm that you:
a.  authored 100% of the code
b.  have the rights to donate the content to Eclipse
c.  contribute the content under the EPL
Comment 5 François Rey CLA 2011-03-31 13:33:45 EDT
a.  I have authored 100% of the code of this fix (which consist of one 'if' statement around a couple of existing lines)
b.  I have the rights to donate the content to Eclipse (I'm working for myself)
c.  I willingly contribute the content under the EPL

Thanks!
Comment 6 Matthias Sohn CLA 2011-03-31 18:32:48 EDT
Which mail account should I use to identify you as author of this patch
(this is used for user authentication in git commits),
bugs.eclipse.org@XXXXXX.XXXXX sounds a bit strange to me ...
Comment 7 François Rey CLA 2011-04-01 02:22:21 EDT
Is it possible to remove my address from the above comment?
Please let's continue this discussion by personal mail using that address for now.
Comment 8 François Rey CLA 2011-06-07 19:51:55 EDT
Actually this has been reported before by Bug 337967 and fixed with http://egit.eclipse.org/r/3544.
Please mark this one as duplicate of 337967.
Comment 9 François Rey CLA 2011-06-08 05:47:06 EDT

*** This bug has been marked as a duplicate of bug 337967 ***