Skip to content

Commit cbf13ea

Browse files
committed
added explanation in readme
1 parent 55ace64 commit cbf13ea

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,26 @@ affectedModuleDetector {
135135
* `./gradlew runAffectedAndroidTests` - runs connected tests
136136
* `./gradlew assembleAffectedAndroidTests` - assembles but does not run on device tests, useful when working with device labs
137137

138+
## SpecifiedBranchCommit vs SpecifiedBranchCommit2
139+
140+
- SpecifiedBranchCommit using `git rev-parse` command for getting sha.
141+
- SpecifiedBranchCommit2 using `git merge base` command for getting sha.
142+
143+
What does it mean?
144+
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,
145+
another developer merged his changes (9 files) into our common remote parent branch - "origin/dev".
146+
147+
Please, look at picture:
148+
![specified_branch_difference.png](specified_branch_difference.png)
149+
150+
Suppose we have changed 6 files in our "feature" branch.
151+
152+
1. Behaviour of SpecifiedBranchCommit:
153+
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.
154+
2. Behaviour of SpecifiedBranchCommit2:
155+
AMD will show the result that 6 files were affected. And this is the correct behavior.
156+
157+
Hence, depends on your CI settings you have to configure AMD right.
138158

139159
## Sample Usage
140160

sample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ affectedModuleDetector {
3131
pathsAffectingAllModules = [
3232
"buildSrc/"
3333
]
34-
specifiedBranch = "main"
35-
compareFrom = "SpecifiedBranchCommit"
34+
specifiedBranch = "origin/main"
35+
compareFrom = "SpecifiedBranchCommit2"
3636
customTasks = [
3737
new AffectedModuleConfiguration.CustomTask(
3838
"runDetektByImpact",

specified_branch_difference.png

19.2 KB
Loading

0 commit comments

Comments
 (0)