Advertisement
Guest User

Untitled

a guest
Jul 8th, 2019
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. (defun full-archive (git-path target-ref output-file)
  2. (run "git" "-C" (truename git-path)
  3. "submodule" "update" "--init" "--recursive")
  4. (let ((submodules (submodules git-path))
  5. (prefix (pathname-name output-file)))
  6. (in-temporary-directory
  7. (let* ((temp-base *default-pathname-defaults*))
  8. (with-posix-cwd git-path
  9. (run "git" "archive"
  10. :format "tar"
  11. :prefix (format nil "~A/" prefix)
  12. "-o" (make-pathname :name prefix
  13. :type "tar"
  14. :defaults temp-base)
  15. target-ref)
  16. (dolist (submodule submodules)
  17. (with-posix-cwd (submodule-path submodule)
  18. (let ((output (make-pathname :name (submodule-name submodule)
  19. :type "tar"
  20. :defaults temp-base)))
  21. (run "git" "archive"
  22. :format "tar"
  23. "-o" output
  24. :prefix (format nil "~A/~A/"
  25. prefix (submodule-path submodule))
  26. (submodule-sha1 submodule))))))
  27. ;; Back in the temp directory
  28. (dolist (tarball (directory "*.tar"))
  29. (run "tar" "xf" tarball))
  30. (run "tar" "cf" output-file prefix)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement