Skip to content

Instantly share code, notes, and snippets.

@creationix
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creationix/320730a0155c33c1a02b to your computer and use it in GitHub Desktop.
Save creationix/320730a0155c33c1a02b to your computer and use it in GitHub Desktop.
-- These bytes are all common between the two versions
5041434b00000002000000109d0e789c9dcc5b0a02310c40d1ffae221b50d2761e2988286ec10d64
da040bf3903132ba7b670dfe5e38d75611602a3992c7884d52e94a601f3952d29c5241ea426a4ae9
03b927af321bb49a879df429ab2a3285c29231b53ed320d876bd2a917875fcb6c7b2c2bd4e70e3d7
26e30827abd325afc25697b97e8e7999cee0636a7ce8b141386087e8f63a5533f9c7ba6b29f01503
9e177bec8b5936d03a8afb01950248f9910e789c9dcb510a02211000d07f4f311728c651578588a2
2b74011d67495877c38cedf875867e1fbcd1454048bc24272e0a859299a93063cc681c633191d822
9998d533755907cc143cc5092d6ad13e697421db29b899752472414a28c64652e93d1e5b877b6d70
4baf5d96054ea3b60b7749a36e6bfd1c796b67d0265a4d1e09e18013a2fa69ab63c83f575d4b8155
7698eb22ea0b838842fd980f789c9dcf4d6ac3301040e1bd4e311768b034fa85120abe422e20c923
77a86d19754292db3767e8f6c1b778328840fb909a8bcef8ba2417426b888da82c016329deb592d1
608ceacc830e019b0c25c49a1cf9665d3489acafda6a721e4db154b559961254becb771f70e31de6
fcfba06d834fe1fdab0ecac2fde0e7a5f6fd0a1a93d5c63b44f898fc34a977dd5984fe63d5dccf17
acef31e1638592eb0f48873e78e5236fd07823f5071e634c33940e789c9dcb5b0ac2301046e1f7ac
6236a0642697362022b803710369f217034d2b31a2cb57b7e079fce0f40690333099b3249b382791
61e4e882b01de7305be83806a491a1eeb161eda499b5cbd6186f829749ac2047f198f4c43ef0e07f
4d98557cf6dbd6e85a2a9de3e38565a1432ff5941a622fdb5adefbb4d523b10996c53b6d69a7bdd6
eaabb5f48e7f5e75c11a2ba8df407359a03e060d4417920e789c9dcbdd09c2301000e0f74c710b28
979fa6064414577081bbe48281a695f6c48eaf33f8fac1a7ab086028cc5c82880d89c7e40987945d
f25e5c1d489275c553cde645abcc0a6394e46a662c2163b55e46aef1545d1cd845e412c9b145aa86
defa5c5678b40e77da3e324d70d6d6af7915d2b6cc6d3fe6a55fc0fa14ac8b2159386044343fed4d
55feb9e6560a6c4b1750d9d57c01bc11453e930b789c9dcccd0902311040e17baa980694fc270bb2
087bf26e039398e040b28138a2e52b96e0f5c1f7789602dec69aa32fd1b9906e9852d639ea886a71
c6d5684cd0a1a2d7029f7c1f13aed461c3c7abb40627a67eceb320d3d8e97dcca3afa0cc6295f636
0438482fa5f8d64ecce51f2b2e3b316183ed37111f5f40370aa909789c33343030333151482f4a4d
2dc9cc4bd72ba92861107c10e5345d4fa6c4fad63ff1b9738d1cabf6561c3284a8cbad2456655e6a
395889f8d59b6f3f4b35b4775d9928207efadac50bc64a3b104a8cc06a6aeca55a5926ea46f20ab1
f41a9d35bc743d36730d0057ed3abab501789cf348cdc9c95708cf2fca49e1724c495128cecf4de5
0200508c070e3d789c4bcccb2fc9482d5248cbcc49e5020023d704bcb101789cab4c2d5148cccb2f
-- Top line is real git, bottom like is js-git output using pako
c9482d5248cbcc49e502003ac0062e65803e789c9bc9583aa1140005fa02156410789c2b0d9a1004
c9482d5248cbcc49e502003ac0062e65 789c9bc9583aa1140005fa021564 789c2b0d9a1004
-- Then they are identical again (after adjusting for 3 byte shift)
00044001aaaa02789c33343030333151c8ad4c2f4a4d2dc9cc4bd72ba92861107c10e5345d4fa6c4
fad63ff1b9738d1cabf6561c020031521043a802789c33343030333151482f4a4d2dc9cc4bd72ba9
2861107c10e5345d4fa6c4fad63ff1b9738d1cabf6561c02000fb90f5da802789c33343030333151
482f4a4d2dc9cc4bd72ba9286108addd60fb72fa892c2fa63eb9bd5632af95a21f59000019bc0f31
3c789cf348cdc9c95708cf2fca49e102001c320427
-- Obviously the last 20 bytes differ, that's the sha1sum checksum
b99023dd9a522d0724422f557e94185adfa179f3
94952b3f7eb07dd4cae883b8a784eb1da1bb7da7
@creationix
Copy link
Author

The test crashes when the 0x9c (after the first gap) is fed to the inflate state machine. That's because it should be getting 0x78 first. This explains why it's complaining about an invalid header.

The question is why does my output match exactly the input from real git, but is missing 3 bytes. I suspect this has something to do with those two objects being ofs-delta types and needing special handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment