基于路径和分支发现Git对象哈希

时间:2012-05-14 04:47:24

标签: git

我正在编写一个小型Web Git可视化工具,我想转换文件路径和分支:

master repository/folder/test => a39bc19d82890f25df2d08d8bea627bb4354e8d8
mybranch repository/folder/test/myfile.py => 76e2242459d360f7429ed748426e660b6dacc9a9

进入Git对象哈希,所以我可以正确使用git showgit cat-file,以及git ls-tree。我的应用目前看起来像这样:

show.php?h=76e2242459d360f7429ed748426e660b6dacc9a9

我想将路径转换为更有用的东西,例如:

show.php?branch=master&path=repository/folder/test/myfile.py

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

分支:路径符号是解决方案。谢谢Noufal Ibrahim!