Skip to content

Commit

Permalink
Add ability to force commit hash in the git link
Browse files Browse the repository at this point in the history
- Rename the var name to a short version
- git-link-use-commit instead of git-link-force-commit-hash-in-link
- Remove `git-link-force-hash` wrapper fn
  • Loading branch information
kaushalmodi authored and sshaw committed Apr 23, 2015
1 parent 1b4229c commit a570765
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions git-link.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
("gitorious.org" git-link-commit-gitorious))
"Maps remote hostnames to a function capable of creating the appropriate commit URL")

(defvar git-link-use-commit nil
"Use the commit name in link even if branch name is available.")

;; Matches traditional URL and scp style
;; This probably wont work for git remotes that aren't services
(defconst git-link-remote-regex "\\([-.[:word:]]+\\)[:/]\\([^/]+/[^/]+?\\)\\(?:\\.git\\)?$")
Expand Down Expand Up @@ -143,7 +146,9 @@
(format "https://%s/%s/tree/%s/%s#%s"
hostname
dirname
(or branch commit)
(if git-link-use-commit
commit
(or branch commit))
filename
(if (and start end)
(format "L%s-L%s" start end)
Expand Down Expand Up @@ -187,7 +192,7 @@

(defun git-link-new (link)
(message (kill-new link))
(when git-link-open-in-browser
(when git-link-open-in-browser
(browse-url link)))

;;;###autoload
Expand Down

0 comments on commit a570765

Please sign in to comment.