Skip to content

Commit 8fe2dab

Browse files
committed
Make `magithub-clone' a little prettier and more flexible
1 parent 58bd5eb commit 8fe2dab

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

magithub.el

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,19 @@ Banned inside existing GitHub repositories if
236236
(let ((args (magithub-clone--get-repo)))
237237
(append args (list (read-directory-name
238238
"Destination: "
239-
magithub-clone-default-directory
239+
(if (s-ends-with? "/" magithub-clone-default-directory)
240+
magithub-clone-default-directory
241+
(concat magithub-clone-default-directory "/"))
242+
nil nil
240243
(cadr args)))))))
241244
(unless (file-writable-p dir)
242245
(user-error "%s does not exist or is not writable" dir))
243-
(when (y-or-n-p (format "Clone %s/%s to %s/%s? " user repo dir repo))
246+
(when (y-or-n-p (format "Clone %s/%s to %s? " user repo dir))
244247
(let* ((proc (start-process "*magithub-clone*" "*magithub-clone*"
245248
magithub-hub-executable
246249
"clone"
247250
(format "%s/%s" user repo)
248-
(expand-file-name repo dir))))
251+
dir)))
249252
(set-process-sentinel
250253
proc
251254
(lambda (p event)
@@ -258,7 +261,7 @@ Banned inside existing GitHub repositories if
258261
(defun magithub-clone--finished (user repo dir)
259262
"After finishing the clone, allow the user to jump to their new repo."
260263
(when (y-or-n-p (format "%s/%s has finished cloning to %s. Open? " user repo dir))
261-
(magit-status (s-chop-suffix "/" (expand-file-name repo dir)))))
264+
(magit-status (s-chop-suffix "/" dir))))
262265

263266
(defvar magithub-features nil
264267
"An alist of feature-symbols to Booleans.

0 commit comments

Comments
 (0)