Update git working dirs by using "remote update" then "reset --hard", in case of upstream forces

This commit is contained in:
Steve Purcell 2012-09-15 20:27:09 +01:00
parent fed0c212bd
commit 5a96d65f6e

View file

@ -304,14 +304,13 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
((and (file-exists-p (expand-file-name ".git" dir)) ((and (file-exists-p (expand-file-name ".git" dir))
(string-equal (pb/git-repo dir) repo)) (string-equal (pb/git-repo dir) repo))
(pb/princ-exists dir) (pb/princ-exists dir)
(pb/run-process dir "git" "pull")) (pb/run-process dir "git" "remote" "update"))
(t (t
(when (file-exists-p dir) (when (file-exists-p dir)
(delete-directory dir t nil)) (delete-directory dir t nil))
(pb/princ-checkout repo dir) (pb/princ-checkout repo dir)
(pb/run-process nil "git" "clone" repo dir))) (pb/run-process nil "git" "clone" repo dir)))
(when commit (pb/run-process dir "git" "reset" "--hard" (or commit "origin/master"))
(pb/run-process dir "git" "checkout" commit))
(apply 'pb/run-process dir "git" "log" "-n1" "--pretty=format:'\%ci'" (apply 'pb/run-process dir "git" "log" "-n1" "--pretty=format:'\%ci'"
(pb/expand-source-file-list dir config)) (pb/expand-source-file-list dir config))
(pb/find-parse-time (pb/find-parse-time