Next: , Up: Plumbing   [Contents][Index]


10.1 Calling Git

Magit provides many specialized functions for calling Git. All of these functions are defined in either magit-git.el or magit-process.el and have one of the prefixes magit-run-, magit-call-, magit-start-, or magit-git- (which is also used for other things).

All of these functions accept an indefinite number of arguments, which are strings that specify command line arguments for Git (or in some cases an arbitrary executable). These arguments are flattened before being passed on to the executable; so instead of strings they can also be lists of strings and arguments that are nil are silently dropped. Some of these functions also require a single mandatory argument before these command line arguments.

Roughly speaking, these functions run Git either to get some value or for side-effects. The functions that return a value are useful to collect the information necessary to populate a Magit buffer, while the others are used to implement Magit commands.

The functions in the value-only group always run synchronously, and they never trigger a refresh. The function in the side-effect group can be further divided into subgroups depending on whether they run Git synchronously or asynchronously, and depending on whether they trigger a refresh when the executable has finished.