-
Notifications
You must be signed in to change notification settings - Fork 403
Show shortened SHA1 in user interface hyperlink #128
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
Show shortened SHA1 in user interface hyperlink #128
Conversation
text.wrapBy("", " (<a href='" + url.commitId(cs.getId()) + "'>commit: " + cs.getId() + "</a>)"); | ||
8000 final String id = cs.getId(); | ||
text.wrapBy("", " (<a href='" + url.commitId(id) | ||
+ "'>commit: " + id.substring(0, Math.min(id.length(), 7)) + "</a>)"); |
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.
@lanwen maybe string format?
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.
yep!
👍 please add string formatting and i'll be ready to merge it |
+ startHREF | ||
+ innerText | ||
+ endHREF | ||
+ ")"); |
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.
@lanwen was this the type of formatting you were envisioning? It seems to clarify the subcomponents of the markup, but I'm not sure that is what you were expecting?
20b0cdf
to
0ba15ec
Compare
text.wrapBy("", " (<a href='" + url.commitId(id) | ||
+ "'>commit: " + id.substring(0, Math.min(id.length(), 7)) + "</a>)"); | ||
final String innerText = "commit: " + id.substring(0, Math.min(id.length(), 7)); | ||
text.wrapBy("", format(" (<a href='%s'>%s</a>)", url.commitId(id), innerText)); |
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.
Is this closer to the style you wanted in the code?
If so, then (if you don't mind) I'd like to rebase this series of commits into a single commit with a better comment, then force push it into this pull request. Would that be ok with you?
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.
No, String.format() that IDEA would suggest to replace automatically.
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.
Unfortunately, I'm not an IDEA user. Can you provide your preferred change to that line?
0ba15ec
to
2f70571
Compare
28e5dbe
to
87d8385
Compare
@@ -42,7 +44,9 @@ void annotate(final GithubUrl url, final MarkupText text, final Entry change) { | |||
|
|||
if (change instanceof GitChangeSet) { | |||
GitChangeSet cs = (GitChangeSet) change; | |||
text.wrapBy("", " (<a href='" + url.commitId(cs.getId()) + "'>commit: " + cs.getId() + "</a>)"); | |||
final String id = cs.getId(); | |||
final String innerText = "commit: " + id.substring(0, Math.min(id.length(), 7)); |
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.
one more thing please: just inline it to string pattern to avoid string concatenation with "+"
Most git repository browsing systems (bitbucket, cgit, github, gitweb) display a short form of the SHA1 (commonly the first 7 characters) with a clickable hyperlink that will take them to a page that includes the full SHA1. This change reduces the visible SHA1 text in the list of changes to the first 7 characters of the SHA1, consistent with those other repository browsers. It also adds assertions that the expected format is used and simplifies the existing annotator tests.
87d8385
to
a8c40b4
Compare
Perfectly! |
Attempt to keep the code DRY.
Please consider this mostly a solicitation for feedback, rather than a final submission that is ready to merge into the master branch.
Is this what you were envisioning by using Hamcrest instead of the style used in the existing test?
This change is