Fix git formula

This should fix the condition where installing git with the wrong options can build a broken git. See #22704.