Skip to content

Commit

Permalink
added explanation in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Evleaps committed Sep 3, 2022
1 parent 55ace64 commit cbf13ea
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ affectedModuleDetector {
* `./gradlew runAffectedAndroidTests` - runs connected tests
* `./gradlew assembleAffectedAndroidTests` - assembles but does not run on device tests, useful when working with device labs

## SpecifiedBranchCommit vs SpecifiedBranchCommit2

- 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:
![specified_branch_difference.png](specified_branch_difference.png)

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.

## Sample Usage

Expand Down
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ affectedModuleDetector {
pathsAffectingAllModules = [
"buildSrc/"
]
specifiedBranch = "main"
compareFrom = "SpecifiedBranchCommit"
specifiedBranch = "origin/main"
compareFrom = "SpecifiedBranchCommit2"
customTasks = [
new AffectedModuleConfiguration.CustomTask(
"runDetektByImpact",
Expand Down
Binary file added specified_branch_difference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cbf13ea

Please sign in to comment.