Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build-logic/src/main/kotlin/GitInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import org.gradle.kotlin.dsl.extra
* Container to memoize Git information retrieved via `git` command executions across all Gradle
* projects.
*/
class GitInfo(val gitHead: String, val gitDescribe: String) {
class GitInfo(val gitHead: String, val gitDescribe: String, private val rawLinkRef: String) {

fun rawGithubLink(file: String): String =
"https://raw.githubusercontent.com/apache/polaris/$rawLinkRef/$file"

companion object {
private fun execGit(rootProject: Project, vararg args: Any): String {
val out =
Expand Down Expand Up @@ -56,7 +60,8 @@ class GitInfo(val gitHead: String, val gitDescribe: String) {
execGit(rootProject, "describe", "--always", "--dirty")
}
else ""
val gitInfo = GitInfo(gitHead, gitDescribe)
val rawLinkRef = if (isRelease) gitDescribe else "HEAD"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why not use gitDescribe for non-releases? HEAD in GH may be off with respect to the current state of the code during build 🤔

Copy link
Member Author

@snazy snazy Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it potentially says 'abcdef-dirty' (not resolvable) - and the commit may not be in the apache/polaris repo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter that the commit is not in GH for not released code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea - the link would be wrong and put in some relevant fields.

val gitInfo = GitInfo(gitHead, gitDescribe, rawLinkRef)
rootProject.extra["gitInfo"] = gitInfo
return gitInfo
}
Expand Down