HIVE-29104: fix git URL in --version output#6411
HIVE-29104: fix git URL in --version output#6411maheshrajus wants to merge 1 commit intoapache:masterfrom
Conversation
|
| url="git://${hostname}${cwd}" | ||
| url=$(git remote get-url origin 2>/dev/null) | ||
| if [ -z "$url" ]; then | ||
| url="Unknown" | ||
| fi |
There was a problem hiding this comment.
This is wrong, It relies that I am currently on origin. In my case origin is the cloudera repo & upstream points to asf repo.
There was a problem hiding this comment.
yeah, normally in CI env build systems when we checkout hive code freshly it will come under "origin" git remote repository. So i added check to cover the origin remote repo only.
We can add condition to check "upstream" remote repository also.
url=$(git remote get-url upstream 2>/dev/null)
if [ -z "$url" ]; then
url=$(git remote get-url origin 2>/dev/null)
fi
if [ -z "$url" ]; then
url="Unknown"
fi
But here also again problem is there, we can configure "upstream" with some different repo also. In this case it will print the upstream pointing git url.
@ayushtkn Can we hard code this git URL(https://github.com/apache/hive.git ) in version info ?
I am checking about hadoop behaviour how they are dealing such cases. thanks !



What changes were proposed in this pull request?
Ensure hive version displays correct git repository URL
Why are the changes needed?
Currently the hive version prints the local repo path of the user who built it, it can't be accessed by anyone, better to have Git remote repo which is "https://github.com/apache/hive.git"
Old version display:
Hive 4.3.0-SNAPSHOT
Git git://VWK/Users/mahesh/Code/opensource/hive -r 843168b
Compiled by maheshrajus on Mon Apr 6 13:01:54 IST 2026
From source with checksum 1d2b9efb1c932f5e999a0c8548537147
Does this PR introduce any user-facing change?
No
How was this patch tested?
Manually tested the git URL after build.
Output after fix:
Hive 4.3.0-SNAPSHOT
Git https://github.com/apache/hive.git -r 843168b
Compiled by maheshrajus on Wed Apr 1 22:24:14 IST 2026
From source with checksum 91c15760fcbe65fc66caa3e5e08b6e80