Open2
Git の ref が commit hash か判別する
まず commit hash であればこの正規表現にマッチする。 \b[0-9a-f]{4,40}\b
ただしこの commit hash にマッチする tag, branch を作成することも出来る。
なので ref を指定して commit を取得し、取得した full commit hash が ref で始まるかチェックする。
始まれば ref は commit hash であり、取得した full commit hash に置き換えることが出来る。
始まらなければ branch または tag である。