What is the format of a git tag object and how to calculate its SHA?

前端 未结 4 836
小蘑菇
小蘑菇 2020-12-11 10:45

I am familiar with how Git creates SHA1 hashes for files (blobs), but not how they are created for tag objects. I assume they are, if I create an annotated tag, but what is

4条回答
  •  离开以前
    2020-12-11 11:05

    The content of a tag object is as follows:

    object 
    type commit
    tag 
    tagger 
    
    
    

    Based on that text the SHA1 value is calculated.

    how might I replicate it outside of Git (e.g., in Perl or Python)?

    Take a look at libgit2 and its various bindings.

提交回复
热议问题