gp_mkpkg: New git() function for getting git output

Allow overriding of the "git" command used via the environment
variable "GIT" (default changed from "/usr/bin/git" to "git").

Central git() function that will call git with the given arguments
and return stdout as string.

Cleaner (not necessarily more efficient) implementation of
count_commits() that makes use of the new git() function.

Use git() where possible, GIT_CMD where it's not (yet) possible.