abeizn opened a new issue, #4961:
URL: https://github.com/apache/incubator-devlake/issues/4961

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   It is first found that in v0.16 and previous versions, DevLake obtains the 
first commit sha of PR in the following way
   select * from commits
   left join pull_request_commits on commits.sha = 
pull_request_commits.commit_sha
   where pull_request_commits.pull_request_id = PR_ID
   order by commits.authored_date ASC
   
   However, since the PR of apache/incubator-devlake in the past half a year is 
basically squash and merge mode. In this mode, the original commit information 
is under the head repo (forked repo) instead of the base repo. The data in the 
DevLake commits table comes from GitExtractor, so the original commits 
information does not exist in the commits table, so we cannot find the 
authored_date of the original first commit.
   Explanation: The merge commit generated after squash merge is not the first 
commit required by DevLake, because the authored date of this merge commit is 
the time of PR merge
   
   In addition, this method of obtaining the first commit author is not 
applicable to rebase and merge, because the commits on the commits page of pr 
are 1, 2; after pr merge, the commits on the main branch are 1' 2', but only in 
pr_commits There will be commit 1, 2.
   
   This method is only suitable for ordinary merge.
   
   ### What do you expect to happen
   
   The first commit sha of a PR can be obtained in all modes(Squash and merge, 
Rebase and merge, Merge (fast-forward), Merge (non-fast-forward))
   
   ### How to reproduce
   
   run github plugin and the repo select apache/incubator-devlake, finally, 
view dora PR coding time metrics
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   main
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to