Show shortened SHA1 in user interface hyperlink#128
Conversation
| text.wrapBy("", " (<a href='" + url.commitId(cs.getId()) + "'>commit: " + cs.getId() + "</a>)"); | ||
| final String id = cs.getId(); | ||
| text.wrapBy("", " (<a href='" + url.commitId(id) | ||
| + "'>commit: " + id.substring(0, Math.min(id.length(), 7)) + "</a>)"); |
|
👍 please add string formatting and i'll be ready to merge it |
| + startHREF | ||
| + innerText | ||
| + endHREF | ||
| + ")"); |
There was a problem hiding this comment.
@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.
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.
No, String.format() that IDEA would suggest to replace automatically.
There was a problem hiding this comment.
Unfortunately, I'm not an IDEA user. Can you provide your preferred change to that line?
0ba15ec to
2f70571
Compare
28e5dbe to
87d8385
Compare
| 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.
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