author | Junio C Hamano <gitster@pobox.com> | |
Thu, 1 Sep 2011 22:43:35 +0000 (15:43 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 9 Sep 2011 21:57:53 +0000 (14:57 -0700) | ||
commit | 6d4bb3833c3d2114d9c4e6d028e961c3fba8b8b3 | |
tree | db65b0f786c8bea5322d2e36a72d6eca3427b1f8 | tree | snapshot |
parent | 5a48d24012fa39cdd02c1cb614db2e62d445e2ce | commit | diff |
fetch: verify we have everything we need before updating our ref
The "git fetch" command works in two phases. The remote side tells us what
objects are at the tip of the refs we are fetching from, and transfers the
objects missing from our side. After storing the objects in our repository,
we update our remote tracking branches to point at the updated tips of the
refs.
A broken or malicious remote side could send a perfectly well-formed pack
data during the object transfer phase, but there is no guarantee that the
given data actually fill the gap between the objects we originally had and
the refs we are updating to.
Although this kind of breakage can be caught by running fsck after a
fetch, it is much cheaper to verify that everything that is reachable from
the tips of the refs we fetched are indeed fully connected to the tips of
our current set of refs before we update them.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The "git fetch" command works in two phases. The remote side tells us what
objects are at the tip of the refs we are fetching from, and transfers the
objects missing from our side. After storing the objects in our repository,
we update our remote tracking branches to point at the updated tips of the
refs.
A broken or malicious remote side could send a perfectly well-formed pack
data during the object transfer phase, but there is no guarantee that the
given data actually fill the gap between the objects we originally had and
the refs we are updating to.
Although this kind of breakage can be caught by running fsck after a
fetch, it is much cheaper to verify that everything that is reachable from
the tips of the refs we fetched are indeed fully connected to the tips of
our current set of refs before we update them.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c | diff | blob | history |