This is an automated email from the ASF dual-hosted git repository.
snazy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new cec41c4b4 Build: `GitInfo` function to build a raw github content URL
(#2910)
cec41c4b4 is described below
commit cec41c4b41b8f114591b6df8f75219690bd6e891
Author: Robert Stupp <[email protected]>
AuthorDate: Sat Nov 1 20:52:23 2025 +0100
Build: `GitInfo` function to build a raw github content URL (#2910)
---
build-logic/src/main/kotlin/GitInfo.kt | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/build-logic/src/main/kotlin/GitInfo.kt
b/build-logic/src/main/kotlin/GitInfo.kt
index 88aa48c2b..bc00c15d0 100644
--- a/build-logic/src/main/kotlin/GitInfo.kt
+++ b/build-logic/src/main/kotlin/GitInfo.kt
@@ -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 =
@@ -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"
+ val gitInfo = GitInfo(gitHead, gitDescribe, rawLinkRef)
rootProject.extra["gitInfo"] = gitInfo
return gitInfo
}