kyb
kyb

Reputation: 8101

Extract meta information from Git, allow git log without fetching full repo

When use Git in a deployment it is often need to get know commit history and relationship. There is no problems when the repo is small. But for big repositories to get full history it is required to fetch all the objects. This operation consumes much bandwidth and takes much time.

So, the problem:

need operate with history of a big Git repo without fetching content.

It would be nice to fetch few MBs and get working git log, git rev-parse, git rev-list, etc. without ability to checkout contents.

idea1. dedicated branch _metainfo with raw output from git log

Store output of git log to dedicated branch. But this approach will require own parser.
This is suitable for very simple tasks.

idea2. prune file contents

git filter-branch tree-filter "echo >**" (pseudo-code). This will change hash of commits, but store commit messages and dates. And old commit hash can be added to filtered commit message.

upd.
Thank you for the answers. I have already read possible duplicates and get know: "no solution at the moment". During this research I implemented my 1st idea as a simple workaround and 2nd as a concept of working solution. Both of them gives semi-usable results. I'd prettify and publish them if community interested.

Upvotes: 1

Views: 347

Answers (1)

torek
torek

Reputation: 487755

What you are looking for is not available today. You could do something like what you propose, but the Git authors are working on a different approach. Git 2.19 has some building blocks in place: promisor packs provide the ability to record that some object(s) exist, and can be obtained over the net from some provider, but are not actually stored in the current Git repository.

A repository containing the commit objects, but having only promises for all the file objects, would be capable of git log (without -p). Fetching some or all of the promised tree and blob objects would enable -p and other additional operations. Once all the promises are fulfilled, you have a normal repository.

However, even Git 2.19 does not have all of the code required to make this work. It has only the concept of promises. See this GitHub blog entry (link goes straight to "partial clone" work) or the Git source technical design notes.

Upvotes: 2

Related Questions