Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/git: take diff stat from merge base
The default behavior for `git diff --stat <target>` is to include all the difference between HEAD and <target> (a diff union), however, we want only what was changed from <target> to HEAD, regardless how far <target> already is from HEAD. For this, we need to consider <target> as our merge base, and for that, we could add `--merge-base` to the command. However, the --merge-base option is available only in recent versions of Git (v2.30+), which are still not installed everywhere, so for that we're going to use the 'A...B' notation, that for `git diff` means: git diff $(git merge-base <taget> HEAD) HEAD Signed-off-by: Bruno Meneguele <[email protected]>
- Loading branch information