{"id":"git-object-id-compute","version":"1.0.0","description":"Compute the Git object id git itself would give a blob, tree, commit or tag under Git's exact object framing.","supported_operations":["sha1 of a git blob","what commit id would git compute","hash of a git tree object","git blob id for this file content","compute a git object hash without a git binary","reproduce git's empty tree sha","git tag object id","sha-256 git object id for the new hash format"],"unsupported_operations":["reading or writing an actual git object store or repository","parsing or validating the structure of a commit/tag body (a syntactically invalid body still gets a real object id, matching git hash-object)"],"semantics":["object_id = hash_algorithm('<object_type> <byte-length of content>\\0' followed by the raw content bytes), hex-encoded lowercase; byte-length is the exact byte count of content, or of the serialized tree for object_type tree.","For blob, commit or tag: content is decoded from content_encoding (utf8 default) and hashed verbatim with no reformatting, validation or reserialization.","For tree: entries is a list of {mode, name, oid}; oid is the child object's id, hex, and must be 40 hex chars for hash_algorithm sha1 or 64 hex chars for sha256; name must not contain '/' or a NUL byte.","Entries are sorted by comparing each entry's name as raw UTF-8 bytes, except a '040000' (directory) entry's name is compared as if a trailing '/' (0x2f) byte were appended. Duplicate names (after this comparison) are invalid_input.","Each sorted entry serializes as: the mode as ASCII decimal-of-octal digits WITHOUT a leading zero (the enum's '040000' is stored and hashed as the 5-byte ASCII '40000'; every other mode is unchanged), one space, the name's UTF-8 bytes, one NUL byte, then the entry's oid as raw bytes (not hex text). sorted_entries in the output reports the list in this sorted order with mode and oid exactly as given.","size is the decoded byte length of content for blob/commit/tag, or the serialized tree's total byte length for tree.","hash_algorithm defaults to sha1 (Git's original object format); sha256 selects Git's newer object format, a completely different id space with no cross-algorithm equivalence."],"limits":{"max_content_bytes":262144,"max_tree_entries":1000},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["object_type"],"properties":{"object_type":{"type":"string","enum":["blob","tree","commit","tag"]},"hash_algorithm":{"type":"string","enum":["sha1","sha256"],"default":"sha1"},"content":{"type":"string","maxLength":262144},"content_encoding":{"type":"string","enum":["utf8","hex","base64","base64url"],"default":"utf8"},"entries":{"type":"array","maxItems":1000,"items":{"type":"object","additionalProperties":false,"required":["mode","name","oid"],"properties":{"mode":{"type":"string","enum":["100644","100755","120000","040000","160000"]},"name":{"type":"string","minLength":1,"maxLength":4096,"pattern":"^[^/\\x00]+$"},"oid":{"type":"string","pattern":"^([0-9a-f]{40}|[0-9a-f]{64})$"}}}}},"oneOf":[{"additionalProperties":false,"required":["object_type","content"],"properties":{"object_type":{"enum":["blob","commit","tag"]},"content":{"type":"string"},"content_encoding":{"type":"string"},"hash_algorithm":{"type":"string"}}},{"additionalProperties":false,"required":["object_type","entries"],"properties":{"object_type":{"const":"tree"},"entries":{"type":"array"},"hash_algorithm":{"type":"string"}}}]},"output_schema":{"type":"object","additionalProperties":false,"required":["object_id","object_type","size","hash_algorithm","sorted_entries"],"properties":{"object_id":{"type":"string","pattern":"^([0-9a-f]{40}|[0-9a-f]{64})$"},"object_type":{"type":"string","enum":["blob","tree","commit","tag"]},"size":{"type":"integer","minimum":0},"hash_algorithm":{"type":"string","enum":["sha1","sha256"]},"sorted_entries":{"type":["array","null"],"items":{"type":"object","additionalProperties":false,"required":["mode","name","oid"],"properties":{"mode":{"type":"string","enum":["100644","100755","120000","040000","160000"]},"name":{"type":"string"},"oid":{"type":"string","pattern":"^([0-9a-f]{40}|[0-9a-f]{64})$"}}}}}},"examples":[{"input":{"object_type":"blob","content":""},"output":{"object_id":"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391","object_type":"blob","size":0,"hash_algorithm":"sha1","sorted_entries":null}},{"input":{"object_type":"tree","entries":[]},"output":{"object_id":"4b825dc642cb6eb9a060e54bf8d69288fbee4904","object_type":"tree","size":0,"hash_algorithm":"sha1","sorted_entries":[]}}],"execute_url":"/v1/tools/git-object-id-compute/versions/1.0.0/execute"}