Skip to content

Add clickable commit link#1120

Open
ylecuyer wants to merge 1 commit intoFredrikNoren:masterfrom
ylecuyer:link-to-commit
Open

Add clickable commit link#1120
ylecuyer wants to merge 1 commit intoFredrikNoren:masterfrom
ylecuyer:link-to-commit

Conversation

@ylecuyer
Copy link
Contributor

@ylecuyer ylecuyer commented Jul 30, 2018

Fixes #1118

This PR adds a new config commitLink to the .ungitrc of the form:

{
  "bugtracking": true,
  "sendUsageStatistics": true,
  "socketId": 1,
  "linkToCommit": {
    "/home/ylecuyer/Projects/ungit": "https://github.com/FredrikNoren/ungit/commit/%H"
  }
}

%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:

  • implementation
  • test
  • update changelog
  • see why links inside commit components are not clickable
  • add doc to README

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: {},
Copy link
Collaborator

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

Copy link
Contributor Author

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

Copy link
Collaborator

@jung-kim jung-kim Aug 13, 2018

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

|
<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>
Copy link
Collaborator

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()

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants