mirror of
https://github.com/correl/melpa.git
synced 2024-11-22 19:18:39 +00:00
Reset git repos to the HEAD branch on the remote.
Not all repositories use 'master' as the name of the master branch. Therefore, we need to query the remote server and see which branch is actually supposed to be tracked by default.
This commit is contained in:
parent
3a354296db
commit
87346e3cc1
1 changed files with 7 additions and 1 deletions
|
@ -294,6 +294,11 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
|
|||
(pb/run-process-match
|
||||
"Fetch URL: \\(.*\\)" dir "git" "remote" "show" "-n" "origin"))
|
||||
|
||||
(defun pb/git-head-branch (dir)
|
||||
"Get the current git repo for DIR."
|
||||
(pb/run-process-match
|
||||
"HEAD branch: \\(.*\\)" dir "git" "remote" "show" "origin"))
|
||||
|
||||
(defun pb/checkout-git (name config dir)
|
||||
"Check package NAME with config CONFIG out of git into DIR."
|
||||
(let ((repo (plist-get config :url))
|
||||
|
@ -310,7 +315,8 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
|
|||
(delete-directory dir t nil))
|
||||
(pb/princ-checkout repo dir)
|
||||
(pb/run-process nil "git" "clone" repo dir)))
|
||||
(pb/run-process dir "git" "reset" "--hard" (or commit "origin/master"))
|
||||
(pb/run-process dir "git" "reset" "--hard"
|
||||
(or commit (concat "origin/" (pb/git-head-branch dir))))
|
||||
(apply 'pb/run-process dir "git" "log" "-n1" "--pretty=format:'\%ci'"
|
||||
(pb/expand-source-file-list dir config))
|
||||
(pb/find-parse-time
|
||||
|
|
Loading…
Reference in a new issue