threads / patch / 43695

patch, 5 partsSupport shallow repositories

Subject: [PATCH (WISP) 0/5] Support shallow repositories

## tl;dr

One message between Oct 30, 2006 and Oct 30, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Johannes Schindelin· Oct 30, 2006, 19:08 UTC · lore
Hi,

Def.: Shallow commits do have parents, but not in the shallow repo, and therefore grafts are introduced pretending that these commits have no parents.

The basic idea is to write the SHA1s of shallow commits into $GIT_DIR/shallow, and handle its contents like the contents of $GIT_DIR/info/grafts (with the difference that shallow cannot contain parent information).

This information is stored in a new file instead of grafts, or even the config, since the user should not touch that file at all (even I did not once edit it myself during development!). Each line contains exactly one SHA1. When read, a commit_graft will be constructed, which has nr_parent < 0 to make it easier to discern from user provided grafts.

Since fsck-objects relies on the library to read the objects, it honours shallow commits automatically.

This stuff is definitely "pu" material:
- I am not quite sure if we have to force non-thin packs when
fetching into a shallow repo (ATM they are forced non-thin). 
Comments?
- A special handling of a shallow upstream is needed. At some
stage, upload-pack has to check if it sends a shallow commit,
and it should send that information early (or fail, if the
client does not support shallow repositories). There is no
support at all for this in this patch series.
- Instead of locking $GIT_DIR/shallow at the start, just
the timestamp of it is noted, and when it comes to writing it,
a check is performed if the mtime is still the same, dying if
it is not. Is this enough?
- I have not touched the "push into/from a shallow repo" issue.
Don't even try it yet.
- If you deepen a history, you'd want to get the tags of the
newly stored (but older!) commits. I don't think this works
right now.
This series does the following:
- gets rid of the call to rev-list in upload-pack
  It is just a tiny change. It is needed so that the client can
tell the server which commits to ignore for the moment. Note that
this is bad for porting to Windows: it should be relatively easy
to spawn other programs in Win32, but is probably lot more work
to just fork _and_ maintain the memory and fd's.
- support fetching into shallow repositories
  Up until now (including this patch), we do not have tool
support to make shallow repos. This patch is separated from
the rest for your reviewing pleasure only.
- support making a shallow repository by cloning with a depth
  "git-clone --depth 20 repo" will lead to a shallow repository,
which contains only commit chains with a length of at most 20. It
also writes an appropriate $GIT_DIR/shallow.
- support deepening a shallow repository
  "git-fetch --depth 20 repo branch" will fetch branch from repo,
but stop at depth 20, updating $GIT_DIR/shallow.
- add tests to t5500
  Since t5500 conveniently provides all we need to test shallow
clones, no new test script was added, but t5500 extended.

Unfortunately, my time resources are scarce in the next few days, but I did not want to hold this stuff back any longer.

Ciao, Dscho

← back to recent threads