update packages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
;;; ol-git-link.el --- Links to specific file version
|
||||
;;; ol-git-link.el --- Links to specific file version -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2009-2014, 2021 Reimar Finken
|
||||
|
||||
@@ -75,7 +75,12 @@
|
||||
|
||||
(defun org-gitbare-open (str _)
|
||||
(let* ((strlist (org-git-split-string str))
|
||||
(gitdir (nth 0 strlist))
|
||||
;; If the provided path ends in /.git, use it. Otherwise,
|
||||
;; append "/.git".
|
||||
(gitdir (let ((path (nth 0 strlist)))
|
||||
(if (string-suffix-p "/.git" path)
|
||||
(expand-file-name path)
|
||||
(expand-file-name ".git" path))))
|
||||
(object (nth 1 strlist)))
|
||||
(org-git-open-file-internal gitdir object)))
|
||||
|
||||
@@ -115,19 +120,22 @@
|
||||
;; Utility functions (file names etc)
|
||||
|
||||
(defun org-git-split-dirpath (dirpath)
|
||||
"Given a directory name, return '(dirname basname)"
|
||||
"Given a directory name, return \\='(dirname basname)"
|
||||
(let ((dirname (file-name-directory (directory-file-name dirpath)))
|
||||
(basename (file-name-nondirectory (directory-file-name dirpath))))
|
||||
(list dirname basename)))
|
||||
|
||||
;; finding the git directory
|
||||
(defun org-git-find-gitdir (path)
|
||||
"Given a file (not necessarily existing) file path, return the
|
||||
a pair (gitdir relpath), where gitdir is the path to the first
|
||||
.git subdirectory found updstream and relpath is the rest of
|
||||
the path. Example: (org-git-find-gitdir
|
||||
\"~/gitrepos/foo/bar.txt\") returns
|
||||
'(\"/home/user/gitrepos/.git\" \"foo/bar.txt\"). When not in a git repository, return nil."
|
||||
"Given a file PATH, return the a pair (gitdir relpath)
|
||||
File does not have to exist.
|
||||
GITDIR is the path to the first .git subdirectory found updstream.
|
||||
RELPATH is the rest of the path.
|
||||
Example:
|
||||
(org-git-find-gitdir \"~/gitrepos/foo/bar.txt\") returns
|
||||
\\='(\"/home/user/gitrepos/.git\" \"foo/bar.txt\").
|
||||
|
||||
When not in a git repository, return nil."
|
||||
(let ((dir (expand-file-name (file-name-directory path)))
|
||||
(relpath (file-name-nondirectory path)))
|
||||
(catch 'toplevel
|
||||
@@ -149,8 +157,9 @@
|
||||
;; Both link open functions are called with a string of
|
||||
;; consisting of three parts separated by a double colon (::).
|
||||
(defun org-git-split-string (str)
|
||||
"Given a string of the form \"str1::str2::str3\", return a list of
|
||||
three substrings \'(\"str1\" \"str2\" \"str3\"). If there are less
|
||||
"Split STR by \"::\" and return list of strings.
|
||||
Given a string of the form \"str1::str2::str3\", return a list of
|
||||
three substrings \\='(\"str1\" \"str2\" \"str3\"). If there are less
|
||||
than two double colons, str2 and/or str3 may be set the empty string."
|
||||
(let ((strlist (split-string str "::")))
|
||||
(cond ((= 1 (length strlist))
|
||||
@@ -192,13 +201,13 @@ than two double colons, str2 and/or str3 may be set the empty string."
|
||||
(let ((file (abbreviate-file-name (buffer-file-name)))
|
||||
(line (line-number-at-pos)))
|
||||
(when (org-git-gitrepos-p file)
|
||||
(org-store-link-props
|
||||
(org-link-store-props
|
||||
:type "git"
|
||||
:link (org-git-create-git-link file line))))))
|
||||
|
||||
(defun org-git-insert-link-interactively (file searchstring &optional description)
|
||||
(interactive "FFile: \nsSearch string: \nsDescription: ")
|
||||
(insert (org-make-link-string (concat "git:" file "::" searchstring) description)))
|
||||
(insert (org-link-make-string (concat "git:" file "::" searchstring) description)))
|
||||
|
||||
;; Calling git
|
||||
(defun org-git-show (gitdir object buffer)
|
||||
|
||||
Reference in New Issue
Block a user