checkcommits: Refactor to reduce complexity.
checkcommits: Refactor to reduce complexity.

Moved code to determine commit and branch into a new function
to reduce the code complexity as reported by gocyclo.

Signed-off-by: James O. D. Hunt <348fbaadfbada55ea105602bf5609e23ac1c4898@intel.com>

bwarden/tests,sboeuf/tests,clearcontainers/tests,devimc/tests,MarioCarrilloA/tests,clearcontainers/tests,chavafg/tests,GabyCT/tests,devimc/tests,GabyCT/tests,chavafg/tests,bwarden/tests,MarioCarrilloA/tests,sboeuf/tests