Following the reasoning (suggesting that checking for git's state files is reasonably future-proof) in this similar suggestion regarding merges, you could look at the source code for how the state is checked by a git client like libgit2 and check for the presence of those files.