Can you get the next commit id before items are commited?

谁都会走 提交于 2019-12-13 03:29:47

问题


I'm currently adding a commit-msg hook that will add the git commit URL as a comment to Jira. The commit URL has the format

http://[server]/[group]/[project]/commit/[commit_id]

Is it possible to obtain the commit id or is it only produced after the item has been committed? Does this mean I need to implement this in a later hook?


回答1:


A git commit id is a SHA-1 hash of:

  • The commit message
  • Author and committer info
  • The date
  • The contents (the hash of the tree)
  • The parent commit hash (or hashes, for merges)

So, the commit id can only be produced after the item has been committed.



来源:https://stackoverflow.com/questions/45850890/can-you-get-the-next-commit-id-before-items-are-commited

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!