danger / kotlin

⚠️ Stop saying "you forgot to …" in code review
MIT License
490 stars 48 forks source link

Git.changedLines returns empty values for PullRequestChangedLines object #250

Open IvanSanchez-uam opened 1 year ago

IvanSanchez-uam commented 1 year ago

I have these lines in my Danger.df.kts file

 warn("Additions = ${git.changedLines.additions}")
 warn("Deletions = ${git.changedLines.deletions}")
 warn("Diff = ${git.changedLines.diff ?: ""}")

in my case I want to get the diff but when calling changedLines extension function just give me

Additions = 0 Deletions = 0 Diff = null

is this extension function really working?, is there another way to get the diff?

I also tried to use the github.pullRequest but there is no a diff value here.

I have the feeling that these lines are not working

val Git.changedLines: PullRequestChangedLines
    get() {
        ...
        val commandRawOutput = shellExecutor.execute("git diff --numstat $headSha $baseSha")
        ...
        val commandRawDiffOutput = shellExecutor.execute("git diff $headSha $baseSha")
        return PullRequestChangedLines(additions, deletions, commandRawDiffOutput)
    }