Home > Enterprise >  What happens for a smart HTTP request for a git pack file when a repository has more than 4 billion
What happens for a smart HTTP request for a git pack file when a repository has more than 4 billion

Time:12-12

I'm writing some code that makes POST requests against git's smart HTTP API to download and process pack files, i.e. against the /git-upload-pack endpoint (in spite of the name, according to git's smart HTTP protocol documentation and my own tests, from the point of view of the client, this does appear to be for downloading files)

Since the number of objects in a pack is communicated by a 4 byte integer, the maximum number of objects is 2^32 - 1, confirmed by git's pack format documentation

Observation: we cannot have [...] more than 4G objects in a pack

So what happens in terms of the response if the repository has more than 4 billion objects to return? Does it, for example, return multiple packs in the same HTTP response? Does it error out? Something else?

CodePudding user response:

So what happens in terms of the response if the repository has more than 4 billion objects to return?

This hasn't happened yet.

Since pack files cannot contain more than 4G objects, and smart transfers always transfer everything in a single (thin) pack, if there are more than 4G objects to transfer, Git stops working.

Since Git has not stopped working, we can conclude that this has not happened.

Should you set up such a repository, you can begin the process of fixing this limit.

  • Related