mirror of
https://github.com/NinjaTrappeur/my-repo-pins.git
synced 2024-06-18 19:41:57 +02:00
Implement h--cal-git-clone-in-dir
This function is in charge of using a underlying git subprocess to clone a remote repository locally.
This commit is contained in:
parent
08b1a44d8b
commit
bc5e1b31ae
15
h-tests.el
15
h-tests.el
|
@ -49,7 +49,7 @@ If DIR doesn't exists, we create it first."
|
|||
(let ((d (file-name-as-directory dir)))
|
||||
(progn
|
||||
(unless (file-directory-p d) (make-directory d t))
|
||||
(h--call-git-in-dir d "init" ))))
|
||||
(h--call-git-in-dir d "init"))))
|
||||
|
||||
;; Test Dirs Setup
|
||||
;;;;;;;;;;;;;;;;;
|
||||
|
@ -239,5 +239,18 @@ For reference: a empty test root looks like this:
|
|||
(should (equal (h--filepath-from-clone-url "git@github.com:NinjaTrappeur/h.el.git") "github.com/NinjaTrappeur/h.el"))
|
||||
(should (equal (h--filepath-from-clone-url "git@github.com:NinjaTrappeur/h.el") "github.com/NinjaTrappeur/h.el")))
|
||||
|
||||
(ert-deftest h--test-git-clone-in-dir ()
|
||||
"Test the h--git-clone-in-dir function"
|
||||
(h--tests-run-on-testroot-1
|
||||
(lambda (dir)
|
||||
(let
|
||||
((tmpdir (make-temp-file "h-test-" t)))
|
||||
(progn
|
||||
(h--git-clone-in-dir
|
||||
(format "file://%s" (concat dir "example1.tld/user1/proj1/"))
|
||||
tmpdir)
|
||||
(should (file-exists-p (format "%s/.git" tmpdir)))
|
||||
(delete-directory tmpdir t))))))
|
||||
|
||||
(provide 'h-tests)
|
||||
;;; h-tests.el ends here
|
||||
|
|
8
h.el
8
h.el
|
@ -59,10 +59,14 @@ Errors out if we can't find it."
|
|||
git-from-bin-path
|
||||
(error "Can't find git. Is h-git-bin correctly set?")))))
|
||||
|
||||
(defun h--call-git-in-dir (dir args)
|
||||
(defun h--call-git-in-dir (dir &rest args)
|
||||
"Call the git binary as pointed by ‘h-git-bin’ in DIR with ARGS."
|
||||
(let ((default-directory dir))
|
||||
(process-file (h--git-path) nil nil nil args)))
|
||||
(apply 'process-file (seq-concatenate 'list `(,(h--git-path) nil "*h git log*" nil) args))))
|
||||
|
||||
(defun h--git-clone-in-dir (clone-url checkout-filepath)
|
||||
"Clone the CLONE-URL repo at CHECKOUT-FILEPATH."
|
||||
(h--call-git-in-dir "~/" "clone" clone-url checkout-filepath))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Internal: builtin fetchers
|
||||
|
|
Loading…
Reference in a new issue