I'm attempting to improve my understanding of FSMs by using them in an application responsible for deploying software to a staging system. A component of this application is responsible for ensuring that git repositories are installed, up-to-date and correctly checked-out. I have modelled the possible states of the repository as a finite-state machine. Most examples that I have seen assume that there will be a series of external events driving the FSM, but in this case there is just an end goal: ensure that the repository is installed, up-to-date and checked-out. I could hard-wire the FSM so that it fires the events necessary to ensure that it reaches the checked-out state: if state is missing, install; if state is out-of-date, update; and so on. But what if I want the system to be more flexible, such that it can be extended to allow multiple predetermined outcomes? I could write a number of conditional statements that control the flow of events sent to the FSM, but that doesn't feel right: it defeats the object of using an FSM in the first place. It feels as though multiple FSMs are required: one that encapsulates the behaviour of the git repository, and one or more that describe the path to take to reach the desired end goal.
At this point, I wonder if my understanding of FSMs is flawed. Is it common to have an FSM control itself by issuing the events required to reach a particular state? And what about having one FSM control another? Is there a name for this type of system?
Update
As requested, here's my state diagram: