Skip to content

HIVE-29104: fix git URL in --version output#6411

Open
maheshrajus wants to merge 1 commit intoapache:masterfrom
maheshrajus:HIVE-29104
Open

HIVE-29104: fix git URL in --version output#6411
maheshrajus wants to merge 1 commit intoapache:masterfrom
maheshrajus:HIVE-29104

Conversation

@maheshrajus
Copy link
Copy Markdown
Contributor

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.

  1. clone the code: https://github.com/apache/hive.git
  2. build the code and check for the version.

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

Comment on lines -39 to +42
url="git://${hostname}${cwd}"
url=$(git remote get-url origin 2>/dev/null)
if [ -z "$url" ]; then
url="Unknown"
fi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is wrong, It relies that I am currently on origin. In my case origin is the cloudera repo & upstream points to asf repo.

Copy link
Copy Markdown
Contributor Author

@maheshrajus maheshrajus Apr 9, 2026

Choose a reason for hiding this comment

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

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 !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ayushtkn i checked hadoop how they are printing it, and modified the code. Can you please review and confirm ? thanks !

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure if it is very good way to do it. It looks as good as hardcoding the github repo url.

@zabetak do you have any opinion around this, or how other projects handle it

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants