-
Notifications
You must be signed in to change notification settings - Fork 155
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
[#569] Allow finding previous authors for ignored commits #1565
[#569] Allow finding previous authors for ignored commits #1565
Conversation
@reposense/21-22-active-team any feedback for @FH-30 ? |
I think the idea is great! However, I have some questions about this feature:
|
Thanks for the feedback @dcshzj , these are my answers to your questions: 1. If the CLI argument happens to conflict with the repo-config.csv argument, there are four possible scenarios as shown in the table below:
This is similar to how current conflicting arguments in RepoSense are handled. 2. Commits in chronological order: Some different possibilities:
The creating of a file is never taken note of in 3. For this last question, maybe prof @damithc can give his opinion too, thanks! |
@FH-30 Good to see you are doing a deep investigation on this issue. Keep it up!
I think no need to use an additional tool if the user's git version is not matching, in the interest of keeping the code simple. In general, it is OK to expect the user to have a recent version of Git, although we may not want to go for a bleeding edge version as the CI platforms we piggy back on e.g., GitHub Actions, Travis, etc. might not have support for very new Git versions. It is ideal (but not compulsory) if the rest of the features work with older versions of Git if only the feature in concern requires a new version of Git. |
Hi @dcshzj, may I have your feedback based on my previous response? Thanks in advance! |
…ous Authors is activated
I have decided to throw an error instead here at line 81, can inform me if it is advisable not to do so. |
@FH-30 Apologies for the delay, here are my replies to your comment.
Sounds good, let's go ahead with your implementation of having the configuration on both repo-config.csv and as a CLI argument. Do make sure that the documentation is clear about how the CLI argument has a higher priority (i.e. even if a user explicitly disables finding previous authors for a particular repository, it will still be done when the CLI argument is provided).
Yep, this is the ideal behaviour. I was thinking of the following scenario:
If commit A is added to the ignore commit list and Git cannot find any previous authors to this file, I am concerned whether Git will assign the rest of the 499 lines to person B. RepoSense's default behaviour is to assign to an unknown author, but I am not sure if Git blame ignore revs will do the same as RepoSense, or does it perform differently.
My personal preference is to notify the user that this feature is not supported after checking the current Git version that the user has, and perform the default behaviour of not finding previous authors. I think let's not introduce hyper-blame into our project. Finally, do mark this PR as ready to review, when you are ready to have it reviewed. |
Thanks for the review @dcshzj , no worries regarding the delay! I will proceed with implementing the tests and documentation shortly! |
@dcshzj All the checks have passed, you may proceed to review this PR! I do hope this PR gets wrapped up by the end of this week, thanks in advance! |
Hi @dcshzj , sorry for bothering (I know you must be busy too). I just hope that you can give a review over the weekend as the deadline for this PR is next Friday, thanks in advance! |
…569-ignorecommitlist-get-previous-authors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Hi, @fzdy1914. I'm guessing that you must be the stage 2 reviewer for this PR. I do hope you can review this PR soon as the deadline is this Friday, thanks! |
It's a soft deadline @FH-30 Can take a few more days if needed. |
Ah that's good to hear, thanks prof! |
I am sorry that this PR is too long for me to review in time, @dcshzj Can just merge before Friday. |
Since I added new system tests for this PR and I noticed that the PR you just merged into the master branch had all the expected authorship.json and commits.json changed for the existing system tests, I believe it is the case that I need to change the expected authorship.json and commits.json for the new system tests in this PR. @dcshzj is it alright if I do so? |
@FH-30 Yup please do, thanks! |
@dcshzj All the tests are now passing! |
Resolves #569.
Enable RepoSense to find previous authors based on IgnoreCommitList
The current implementation of RepoSense assigns lines last modified by a commit in the IgnoreCommitList to an unknown author. This means that when a commit involving a bulk change occurs (ex: a formatting change) and that commit is added to the ignore commit list, the
authorship.json
file generated by RepoSense will not contain much meaningful information as most of the lines are assigned to an unknown author.This PR fixes this issue by utilizing git's
--ignore-revs-file
command. RepoSense will create a.git-blame-ignore-revs
file (containing the commit hashes from theIgnoreCommitList
in the final config object passed to theanalyzeRepo
method inReportGenerator.java
) in the directory of each cloned repository that has the option to find previous authors enabled. This can be enabled either by addingyes
to theFind Previous Authors
column inrepo-config.csv
or by adding--find-previous-authors
/-F
through the CLI. The proposed implementation in this PR has the default behavior to still assign lines due to ignored commits to an unknown author in the event that there is no previous commit that touched that line before the ignored commit. Note that the blamed lines still remain the same (can be seen inauthorship.json
file generated) but only the author to who it is blamed to is changed when Finding Previous Authors is enabled.Commit Message: