[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/orgit 609fd0ccfb 68/76: orgit-export: Handle missing local
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/orgit 609fd0ccfb 68/76: orgit-export: Handle missing local repository explicitly |
Date: |
Thu, 13 Jan 2022 13:58:48 -0500 (EST) |
branch: elpa/orgit
commit 609fd0ccfb5268704b5bc7d7ac1014d4960b9707
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
orgit-export: Handle missing local repository explicitly
Use correct error-symbol in this case as well.
Closes #10.
---
orgit.el | 54 ++++++++++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/orgit.el b/orgit.el
index 1feb78396f..64904eb6d3 100644
--- a/orgit.el
+++ b/orgit.el
@@ -401,31 +401,37 @@ store links to the Magit-Revision mode buffers for these
commits."
;;; Export
(defun orgit-export (path desc format gitvar idx)
- (pcase-let*
- ((`(,dir ,rev) (split-string path "::"))
- (default-directory (file-name-as-directory (expand-file-name dir)))
- (remotes (magit-git-lines "remote"))
- (remote (magit-get "orgit.remote"))
- (remote (cond ((= (length remotes) 1) (car remotes))
- ((member remote remotes) remote)
- ((member orgit-remote remotes) orgit-remote))))
- (if remote
- (if-let ((link (or (when-let ((url (magit-get "orgit" gitvar)))
- (format-spec url `((?r . ,rev))))
- (when-let ((url (magit-get "remote" remote "url"))
- (format (cl-find-if
- (lambda (elt)
- (string-match (car elt) url))
- orgit-export-alist)))
- (format-spec (nth idx format)
- `((?n . ,(match-string 1 url))
- (?r . ,rev)))))))
- (orgit--format-export link desc format)
- (signal 'org-link-broken
- (list (format "Cannot determine public url for %s" path))))
+ (pcase-let* ((`(,dir ,rev) (split-string path "::"))
+ (dir (file-name-as-directory (expand-file-name dir))))
+ (if (file-exists-p dir)
+ (let* ((default-directory dir)
+ (remotes (magit-git-lines "remote"))
+ (remote (magit-get "orgit.remote"))
+ (remote (cond ((= (length remotes) 1) (car remotes))
+ ((member remote remotes) remote)
+ ((member orgit-remote remotes) orgit-remote))))
+ (if remote
+ (if-let ((link
+ (or (when-let ((url (magit-get "orgit" gitvar)))
+ (format-spec url `((?r . ,rev))))
+ (when-let ((url (magit-get "remote" remote "url"))
+ (format (cl-find-if
+ (lambda (elt)
+ (string-match (car elt) url))
+ orgit-export-alist)))
+ (format-spec (nth idx format)
+ `((?n . ,(match-string 1 url))
+ (?r . ,rev)))))))
+ (orgit--format-export link desc format)
+ (signal 'org-link-broken
+ (list (format "Cannot determine public url for %s"
+ path))))
+ (signal 'org-link-broken
+ (list (format "Cannot determine public remote for %s"
+ default-directory)))))
(signal 'org-link-broken
- (list (format "Cannot determine public remote for %s"
- default-directory))))))
+ (list (format "Cannot determine public url for %s %s"
+ path "(which itself does not exist)"))))))
(defun orgit--format-export (link desc format)
(pcase format
- [nongnu] elpa/orgit 9f09553c09 63/76: orgit-status-store: Account for topics, (continued)
- [nongnu] elpa/orgit 9f09553c09 63/76: orgit-status-store: Account for topics, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 7105c135ce 70/76: Add SPDX-License-Identifier library header, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 26242895ef 72/76: Bump dependencies, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 66367d6bfc 76/76: Release version 1.7.2, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 1b1c8d6963 26/76: use org-link-set-parameters when available, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit f8ca2fb77b 40/76: orgit-abbreviate-hashes: New option, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit f705d581ec 41/76: orgit-rev-store-1: Resolve full hash when not abbreviating, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 0242088fb2 59/76: No longer depend on dash, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 7d6afa5ae9 60/76: orgit-log-open: Call magit-log-arguments from repo, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit a4e689f009 64/76: make: Remove obsolete dependencies, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 609fd0ccfb 68/76: orgit-export: Handle missing local repository explicitly,
ELPA Syncer <=
- [nongnu] elpa/orgit b7eb6de8c6 19/76: orgit-log-store: use first rev as intended, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 78a3932797 45/76: orgit--{current-repository, repository-directory: New functions, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 467f424df4 47/76: orgit-store-repository-id: New option, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit d7e773e1b6 50/76: Add .github/FUNDING.yml, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 9e5f93d516 51/76: Update for Org 9.3, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit 1d257c8cb2 52/76: Change term used for copyright holders, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit a4a565be2a 74/76: Export repository-ID based links, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit f956d802f1 75/76: orgit-rev-description-format: New option, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit e8db8dc741 69/76: orgit-*-complete-link: Respect orgit-store-repository-id, ELPA Syncer, 2022/01/13
- [nongnu] elpa/orgit ab28d1785c 67/76: orgit-export: Signal correct error type, ELPA Syncer, 2022/01/13