(let ((default-directory "/home/vision/"))
(magit-pull)
(magit-fetch "upstream")
(magit-merge "upstream/master")
(magit-push))
I’m getting:
Running git fetch upstream
Git is already running
How can I wait for fetch finish?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Magit is intended as an interactive front-end for git, so things like
magit-fetchare not really intended to be run from your code… But if you really insist, a quick look at the code shows you thatmagit-processis a variable that holds the process while it is running, and it’s cleared when it’s done. You can therefore use it with a loop that waits until that happens:But that’s really pushing it — for example, what happens when the fetch fails?
BTW, another thing that you can do is look at the source which is a one-line function in the
magit-fetchcase:and write code that uses the non-async version:
(And you can suggest a patch to add an optional flag argument, but that seems like an iffy feature for an interactive tool…)