Fix bug 1021016
Bug 1021355

Check for git objects with `git rev-parse` rather than for references with
`git show-ref`.
Merge pull request #3946 from pmorie/bugs/1021016

Merged by openshift-bot
Merge pull request #3943 from BanzaiMan/dev/hasari/bz1021355

Merged by openshift-bot