AffectedModuleDetector icon indicating copy to clipboard operation
AffectedModuleDetector copied to clipboard

Feature/new specified branch commit

Open Evleaps opened this issue 3 years ago • 3 comments

Feature/new specified branch commit

Problem: Depends on CI configurations might be some problem with false positive affected files in AMD.

What I did?

  • SpecifiedBranchCommit using git rev-parse command for getting sha.
  • SpecifiedBranchCommit2 using git merge base command for getting sha.

What does it mean? When we run any AMD command we compare the current branch with the specified parent branch. Consider an example when, during the development of our feature, another developer merged his changes (9 files) into our common remote parent branch - "origin/dev".

Please, look at picture: image

Suppose we have changed 6 files in our "feature" branch.

  1. Behaviour of SpecifiedBranchCommit: AMD will show the result that 15 files were affected. Because our branch is not updated (pull) and AMD will see our 6 files and 9 files that were merged by another developer.
  2. Behaviour of SpecifiedBranchCommit2: AMD will show the result that 6 files were affected. And this is the correct behavior.

Hence, depends on your CI settings you have to configure AMD right.

Evleaps avatar Sep 03 '22 15:09 Evleaps

Codecov Report

Merging #164 (0f6a7f2) into main (ae455b5) will increase coverage by 0.89%. The diff coverage is 100.00%.

:exclamation: Current head 0f6a7f2 differs from pull request most recent head 06b84e0. Consider uploading reports for the commit 06b84e0 to get more accurate results

@@             Coverage Diff              @@
##               main     #164      +/-   ##
============================================
+ Coverage     51.50%   52.39%   +0.89%     
- Complexity       72       75       +3     
============================================
  Files            13       14       +1     
  Lines           532      542      +10     
  Branches         98       99       +1     
============================================
+ Hits            274      284      +10     
  Misses          232      232              
  Partials         26       26              
Impacted Files Coverage Δ
...ectedmoduledetector/AffectedModuleConfiguration.kt 100.00% <100.00%> (ø)
...ledetector/commitshaproviders/CommitShaProvider.kt 100.00% <100.00%> (ø)
...mmitshaproviders/SpecifiedBranchCommitMergeBase.kt 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Sep 03 '22 15:09 codecov[bot]

This seems to be failing both building the sample app and the code coverage (there does not appear to be any tests in here).

This also seems to be a near duplicate of ForkCommit, can you explain the difference?

joshafeinberg avatar Sep 28 '22 16:09 joshafeinberg

This seems to be failing both building the sample app and the code coverage (there does not appear to be any tests in here).

This also seems to be a near duplicate of ForkCommit, can you explain the difference?

Hey Josh! I added tests for the new approach! And yes, u are right, SpecifiedBranchCommit2 same as the ForkCommit approach, but they have a big difference. ForkCommit - compare against the commit the branch was FORKED FROM but SpecifiedBranchCommit2- compare against the nearest ancestors with $specifiedBranch

We must save SpecifiedBranchCommit2 and Fork commit separately.

Evleaps avatar Oct 05 '22 21:10 Evleaps