jodavimehran / code-tracker

GNU General Public License v3.0
16 stars 6 forks source link

Invalid Change History - org.eclipse.jgit/src/org.eclipse.jgit.api.PullCommand#call()$if(232-235) #130

Open flozender opened 1 year ago

flozender commented 1 year ago

In commit 0210e0e299bed69176e0a929d0b67f3cf9fb1e37 and file org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java, element org.eclipse.jgit/src/org.eclipse.jgit.api.PullCommand#call()$if(280-283) was tracked.

This code element is mapped to code element org.eclipse.jgit/src/org.eclipse.jgit.api.PullCommand#call()$if(232-235) in commit db55d13f5f4b641a9390076ced6b1775bcfcd6f6 as the next change in history, however, it should be matched with org.eclipse.jgit/src/org.eclipse.jgit.api.PullCommand#call()$if(192-192) in the same commit and file.

Oracle filename: jgit-PullCommand-call-IF_STATEMENT-9.json

flozender commented 1 year ago

Correct change history:

"expectedChanges": [
    {
      "parentCommitId": "2160c09dd4f678c5f2f8e730945be637210b39de",
      "commitId": "db55d13f5f4b641a9390076ced6b1775bcfcd6f6",
      "commitTime": 1286546248,
      "changeType": "introduced",
      "elementFileBefore": "org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java",
      "elementNameBefore": "org.eclipse.jgit/src/org.eclipse.jgit.api.PullCommand#call()$if(192-195)",
      "elementFileAfter": "org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java",
      "elementNameAfter": "org.eclipse.jgit/src/org.eclipse.jgit.api.PullCommand#call()$if(192-195)",
      "comment": "added with method"
    }
  ]
tsantalis commented 1 year ago

@flozender There are two identical statements in the method.

if (monitor.isCancelled())
            throw new CanceledException(MessageFormat.format(
                    JGitText.get().operationCanceled,
                    JGitText.get().pullTaskName));

At some point, these two should have been matched incorrectly one with the other and vice-versa. But I cannot find in which commit this happened. I debugged commit-by-commit up to https://github.com/flozender/jgit/commit/770c733687d9f2f71f30822f9691427bf83b7577 but I didn't find any issue. Can you help to find this problematic commit?

flozender commented 1 year ago

@tsantalis

Yes, the problematic commit is 7668a46.

The mapping here is (leftBlock <--> rightBlock):

if(232-235)<0544c9a> <--> if(198-201)<7668a46>

Hope this helps!

tsantalis commented 1 year ago

Screenshot from 2023-10-18 00-14-56

Screenshot from 2023-10-18 00-16-48