From bedb544e865604c7ac9e860dd5a464a2f4e77e2a Mon Sep 17 00:00:00 2001 From: Ivan Alvarado Date: Sun, 19 Jan 2025 11:14:54 -0800 Subject: [PATCH] Add documentation for new comparison strategy to README --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f466634..5d245fd 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ affectedModuleDetector { - `logFilename`: A filename for the output detector to use - `logFolder`: A folder to output the log file in - `specifiedBranch`: A branch to specify changes against. Must be used in combination with configuration `compareFrom = "SpecifiedBranchCommit"` + - `specifiedRawCommitSha`: A raw commit SHA to specify changes against. Must be used in combination with configuration `compareFrom = "SpecifiedRawCommitSha"` - `ignoredFiles`: A set of files that will be filtered out of the list of changed files retrieved by git. - `buildAllWhenNoProjectsChanged`: If true, the plugin will build all projects when no projects are considered affected. - `compareFrom`: A commit to compare the branch changes against. Can be either: @@ -120,7 +121,8 @@ affectedModuleDetector { - ForkCommit: compare against the commit the branch was forked from - SpecifiedBranchCommit: compare against the last commit of `$specifiedBranch` using `git rev-parse` approach. - SpecifiedBranchCommitMergeBase: compare against the nearest ancestors with `$specifiedBranch` using `git merge base` approach. - + - SpecifiedRawCommitSha: compare against the provided raw commit SHA. + **Note:** specify the branch to compare changes against using the `specifiedBranch` configuration before the `compareFrom` configuration - `excludedModules`: A list of modules that will be excluded from the build process, can be the name of a module, or a regex against the module gradle path - `includeUncommitted`: If uncommitted files should be considered affected @@ -162,6 +164,12 @@ Suppose we have changed 6 files in our "feature" branch. Hence, depending on your CI settings you have to configure AMD appropriately. +## SpecifiedRawCommitSha + +If you want AMD plugin to skip performing the git operations under-the-hood (like `git rev-parse` and `git merge base`), you can provide the raw commit SHA you wish to compare against. +One of the main reasons you might want to follow this approach is, maybe your environment leverages [Git mirroring](https://docs.github.com/en/repositories/creating-and-managing-repositories/duplicating-a-repository) for speed optimizations, for example CI/CD environments. +Mirroring _can_ lead to inaccurate common ancestor commits as the duplicated repository _may be_ out of sync with the true remote repository. + ## Sample Usage Running the plugin generated tasks is quite simple. By default, if `affected_module_detector.enable` is not set,