Como posso obter o ID de confirmação mais recente da ramificação atualmente registrada no git, usando ANT, sem ter uma instalação ativa do git?
Eu usei os seguintes detalhes de formigas para recuperar o ID de confirmação mais recente da ramificação, quais são as advertências que devo me preocupar em usar esse método?
Existem casos extremos em que eu não recuperaria os valores esperados?
<scriptdef name="substring" language="javascript">
<attribute name="text" />
<attribute name="start" />
<attribute name="end" />
<attribute name="property" />
<![CDATA[
var text = attributes.get("text");
var start = attributes.get("start");
var end = attributes.get("end") || (text.length() - 1);
project.setProperty(attributes.get("property"), text.substring(start, end));
]]>
</scriptdef>
<loadfile property="head.branch" srcfile="${basedir}/.git/HEAD" />
<substring text="${head.branch}" start="5" property="branch" />
<loadfile property="head.commitId" srcfile="${basedir}/.git/${branch}"/>