-
Notifications
You must be signed in to change notification settings - Fork 639
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
Add clickable commit link #1120
base: master
Are you sure you want to change the base?
Conversation
@@ -151,6 +151,9 @@ const defaultConfig = { | |||
|
|||
// a string of ip to bind to, default is `127.0.0.1` | |||
ungitBindIp: '127.0.0.1', | |||
|
|||
// example { "/home/projects/ungit" : "https://github.com/FredrikNoren/ungit/commit/%H" } use %H for full commit hash and %h for short commit hash | |||
linkToCommit: {}, |
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.
So we should need to do this, we could just extract from the remote repo location right?
from there we can derive the url path
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 we can't, one repo may have many remotes (ie. one for github and one for heroku) so we can't decide which one win over the other. And some remotes can be privates (ie. git.example.com) and we can't derive the url path
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.
Oh yea, you are absolutely right. but I bet most repos have single remote and conjunction with this map override method, it would be much better user experience
@@ -22,7 +22,12 @@ | |||
+<span data-bind="text: numberOfAddedLines"></span>, | |||
-<span data-bind="text: numberOfRemovedLines"></span> | |||
| | |||
<span data-bind="text: sha1.substr(0, 8)"></span> | |||
<!-- ko if: commitLink() --> | |||
<a data-bind="text: sha1.substr(0, 8), attr: { href: commitLink(), target: '_blank' }"></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.
Click operation is being hijacked for in other components for handling node click and node unclicks. You would have to touch up on CommitViewModel.prototype.stopClickPropagation()
Fixes #1118
This PR adds a new config
commitLink
to the.ungitrc
of the form:%h
and%H
are used respectively for short sha1 hash and sha1 hash (as in git format)If this config is not set the behaviour of ungit doesn't change otherwise the sha1 of the commit component is clickable and link to the interpolated url.
I have an issue with the commit component because links (mailto included) are no clickable and I haven't figured out why.
Todos: