-
Notifications
You must be signed in to change notification settings - Fork 74
Add originUrl to versionDetails #1155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
058af76 to
ab6ad4e
Compare
ab6ad4e to
23527fd
Compare
✅ Successfully generated changelog entry!Need to regenerate?Simply interact with the changelog bot comment again to regenerate these entries. 📋Changelog Preview💡 Improvements
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds functionality to expose the git remote origin URL through the VersionDetails interface by implementing a new getOriginUrl() method that executes git config remote.origin.url.
Changes:
- Added
getOriginUrl()method toVersionDetailsinterface - Implemented
getOriginUrl()inVersionDetailsImplwith error handling - Initialized
originUrlprovider using git config command
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/com/palantir/gradle/gitversion/VersionDetails.java | Added getOriginUrl() method signature to the interface |
| src/main/java/com/palantir/gradle/gitversion/VersionDetailsImpl.java | Implemented getOriginUrl() method with provider initialization and error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return Strings.emptyToNull(this.originUrl.get()); | ||
| } catch (RuntimeException e) { | ||
| log.error("VersionDetailsImpl::getOriginUrl failed", e); | ||
| return null; |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method returns null when the origin URL is empty or when an exception occurs, making it impossible for callers to distinguish between these two scenarios. Consider throwing a meaningful exception or returning an Optional to better communicate the absence of a value versus an error condition.
| return null; | |
| throw e; |
| try { | ||
| return Strings.emptyToNull(this.originUrl.get()); | ||
| } catch (RuntimeException e) { | ||
| log.error("VersionDetailsImpl::getOriginUrl failed", e); |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message 'VersionDetailsImpl::getOriginUrl failed' doesn't provide helpful context about why the operation failed. Consider including more specific information, such as 'Failed to retrieve git remote origin URL' to make debugging easier for users.
| log.error("VersionDetailsImpl::getOriginUrl failed", e); | |
| log.error("Failed to retrieve git remote origin URL in VersionDetailsImpl#getOriginUrl", e); |
|
can you add to the existing tests please? |
Changes
Adds
getOriginUrl()method toVersionDetailsinterface to expose the git remote origin URL==COMMIT_MSG==
Add originUrl to versionDetails to get the value of
git config remote.origin.url==COMMIT_MSG==