Check for valid git repository in GitInfo::getHeadCommitDate

Ensure that GitInfo::getHead returns a valid value before attempting to
use the git binary to extract a commit date.

Bug: 64948
Change-Id: Ib0d245306842706dbb5d4b9522bb381a5f55526c