Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of a new feature to allow collect the refactorings implemented at the time of the merge #753

Open
aoliveira100 opened this issue Jun 22, 2024 · 4 comments

Comments

@aoliveira100
Copy link

aoliveira100 commented Jun 22, 2024

Currently, when I pass a merge commit to get the refactorings, the Refactoring Miner returns duplicate refactorings, which were implemented in the branch commits, and not those effectively implemented during the merge operation.

I propose the creation of a new feature to allow the collection of refactorings implemented at the time of the merge. Although it is uncommon to implement refactorings at this time, we know that this is possible.

It could be an API detectAtMergeCommit(mergeCommit) that collects refactorings exclusively implemented in the merge. (PS: I'm not referring to the accumulated refactorings of the branches in this merge, but the specific refactorings implemented only in the merge).

In my research work, I have discarded the merge commits from my samples precisely because the Refactoring Miner returns duplicate refactorings in this case. I have considered this limitation a threat to external validity. I have justified that the number of situations where the DevOps/developers implement refactorings at the exact moment of executing the merge is relatively low.

Thanks in advance.

@aoliveira100 aoliveira100 changed the title Creation of a new feature to allow the collection of refactorings implemented at the time of the merge. Creation of a new feature to allow collect the refactorings implemented at the time of the merge Jun 22, 2024
@tsantalis
Copy link
Owner

tsantalis commented Jun 23, 2024

@aoliveira100
Thank your for your interest in our project and for your feature request.

It is not clear to me how we can get the specific refactorings implemented only in the merge
RefactoringMiner can obtain refactorings given a pair of child and parent commits.

But I don't think any pair of merge commit and its parent commits gives what you are looking for.

Do you have any idea, how we could obtain those refactorings implemented only in the merge?

@aoliveira100
Copy link
Author

aoliveira100 commented Jun 24, 2024

@tsantalis

Thank you for support

Consider the merge commit with sha1 573ba90. When we run the command git diff 573ba90 573ba90^1 573ba90^2 (where ^1 is parent 1 of the merge commit and ^2 is parent 2), we can identify through the ++/-- directives which lines of code were added (++) and removed (--) in the merge commit. Looking at the lines with ++ (added in the merge), some of these new implementations could be code refactorings. We know this must be an exception, but it can happen.

Example:
++ if ($field_name == $selected) {
++
++ echo "field_type: {$field['type']}\n";
++ echo "field_name: {$field_name}\n";
++
++ foreach ( $node->$field_name as $language => $value ) {

https://git-scm.com/docs/git-diff

@tsantalis
Copy link
Owner

@aoliveira100
Do you have a merge commit in Java to experiment with?
Even if it an artificial one that you created, it is totally fine.

@aoliveira100
Copy link
Author

@tsantalis
Of course. I will prepare it next week. I'm traveling for work today and returning July 1st.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants