Or rather, use `git-var` as suggested:  `git var GIT_EDITOR` will do all that for us, and then we can just strip and use it like you've already got code for.