jerryshao opened a new pull request, #14939: URL: https://github.com/apache/gravitino/pull/14939
### What changes were proposed in this pull request? - `common/build.gradle.kts`: resolve the commit id with `git rev-parse HEAD` (run in `rootDir`, result accepted only if it is a 40-hex SHA). The previous file-parsing logic is kept as a fallback and now also handles an absolute `gitdir:` path, `commondir` (branch refs of linked worktrees) and `packed-refs`. If nothing works, it still prints a `WARN` and writes an empty value. - `common/build.gradle.kts`: the jar task now refreshes the copy of `gravitino-build-info.properties` that `processResources` placed in `build/resources/main`. Previously that stale copy won over the freshly generated file, so the JAR could carry an empty commit id even when `src/main/resources` was correct. The jar task is also no longer skipped as UP-TO-DATE, so a new commit is always reflected. - `server/build.gradle.kts`: remove an unused duplicate of `getGitCommitId()`. - `clients/client-python/scripts/generate_version.py`: same fix for the Python client's `version.ini` (it also returned an empty id for a detached HEAD). ### Why are the changes needed? `git.commit.id` was empty in `gravitino-build-info.properties`, the common JAR and the Python `version.ini` for: linked git worktrees (absolute `gitdir:` path was joined to `rootDir`; branch refs live in the common git dir), detached HEAD, and checkouts whose refs were packed by `git gc`/`git pack-refs`. Fixes #14857 ### Does this PR introduce _any_ user-facing change? No. The commit id shown by the server/client version info is now populated in the cases above. ### How was this patch tested? Built `:common:jar` and ran `generate_version.py`, comparing the output with `git rev-parse HEAD`, both with git available and with git removed from `PATH` (to exercise the fallback): named-branch linked worktree, detached linked worktree, normal checkout with loose refs, packed refs, detached HEAD, linked worktree with packed refs, and a `git archive` copy without `.git` (build succeeds, `WARN` printed, empty value). All as expected. No unit tests were added, since this is build-script logic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
