leandroBorgesFerreira / dag-command

Affected gradle modules by branch
Apache License 2.0
46 stars 11 forks source link

Diff ignores up to 3% of changes #30

Closed m-kubis closed 11 months ago

m-kubis commented 11 months ago

As I understand it, he core trigger for the diff to identify the change is https://github.com/leandroBorgesFerreira/dag-command/blob/d9c985d094ac7c0feaa7e96fdc25fb5caa4386ab/src/main/kotlin/io/github/leandroborgesferreira/dagcommand/logic/ChangedModules.kt#L9

According to the GIT doc though, up to 3% of the changes are outright ignored:

<limit>
An integer parameter specifies a cut-off percent (3% by default). Directories contributing less than this percentage of the changes are not shown in the output.

https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-ltlimitgt

This causes a bug resulting in the modified modules not being identified as long as the changes are up to this threshold.

>git diff "<redacted>" --dirstat=files
  11.5% vectoring/src/main/java/com/<redacted>
   7.2% vectoring/src/main/java/com/<redacted>
  10.1% vectoring/src/main/java/com/<redacted>
   8.6% vectoring/src/main/java/com/<redacted>
   8.6% vectoring/src/main/java/com/<redacted>
   8.6% vectoring/src/main/java/com/<redacted>
   5.7% vectoring/src/main/
  10.1% vectoring/src/test/java/com/<redacted>
   7.2% vectoring/src/test/java/com/<redacted>
  10.1% vectoring/src/test/java/com/<redacted>
   5.7% vectoring/src/test/java/com/<redacted>

versus lowering the ignore threshold to 0

>git diff "<redacted>" --dirstat=files,0
   2.8% time/src/main/java/com/<redacted>
   1.4% uicommons/src/main/java/com/<redacted>
   1.4% vectoring/src/androidTest/java/com/<redacted>
   1.4% vectoring/src/main/java/com/<redacted>
  11.5% vectoring/src/main/java/com/<redacted>
   7.2% vectoring/src/main/java/com/<redacted>
  10.1% vectoring/src/main/java/com/<redacted>
   8.6% vectoring/src/main/java/com/<redacted>
   8.6% vectoring/src/main/java/com/<redacted>
   1.4% vectoring/src/main/java/com/<redacted>
   5.7% vectoring/src/main/java/com/<redacted>
   1.4% vectoring/src/main/java/com/<redacted>
   1.4% vectoring/src/main/java/com/<redacted>
   1.4% vectoring/src/main/res/layout/
   1.4% vectoring/src/main/res/values/
  10.1% vectoring/src/test/java/com/<redacted>
   7.2% vectoring/src/test/java/com/<redacted>
  10.1% vectoring/src/test/java/com/<redacted>
   2.8% vectoring/src/test/java/com/<redacted>
   2.8% vectoring/src/test/java/com/<redacted>

notice two more modules being reported.

I took a liberty of creating a simple fix.

leandroBorgesFerreira commented 11 months ago

This issue was fixed by the author of the issue in the PR #31. Version 1.8.1 contains the fix.

Thanks for the contribution @m-kubis šŸŽ‰ šŸŽ‰ šŸŽ‰ šŸŽ‰ šŸŽ‰

m-kubis commented 11 months ago

Thanks for the quick reaction and an immediate release.