<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/upload-pack.c, branch v1.8.2.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.8.2.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.8.2.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-04-04T19:59:55Z</updated>
<entry>
<title>Merge branch 'jk/peel-ref' into maint</title>
<updated>2013-04-04T19:59:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-04-04T19:59:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5ccb7e2ef33612075fe6eedbf08c020b3ea1e7b9'/>
<id>urn:sha1:5ccb7e2ef33612075fe6eedbf08c020b3ea1e7b9</id>
<content type='text'>
* jk/peel-ref:
  upload-pack: load non-tip "want" objects from disk
  upload-pack: make sure "want" objects are parsed
  upload-pack: drop lookup-before-parse optimization
</content>
</entry>
<entry>
<title>upload-pack: load non-tip "want" objects from disk</title>
<updated>2013-03-17T05:19:29Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-03-16T10:28:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f59de5d1ff9b0f9d570df99128f41520a281f9a5'/>
<id>urn:sha1:f59de5d1ff9b0f9d570df99128f41520a281f9a5</id>
<content type='text'>
It is a long-time security feature that upload-pack will not
serve any "want" lines that do not correspond to the tip of
one of our refs. Traditionally, this was enforced by
checking the objects in the in-memory hash; they should have
been loaded and received the OUR_REF flag during the
advertisement.

The stateless-rpc mode, however, has a race condition here:
one process advertises, and another receives the want lines,
so the refs may have changed in the interim.  To address
this, commit 051e400 added a new verification mode; if the
object is not OUR_REF, we set a "has_non_tip" flag, and then
later verify that the requested objects are reachable from
our current tips.

However, we still die immediately when the object is not in
our in-memory hash, and at this point we should only have
loaded our tip objects. So the check_non_tip code path does
not ever actually trigger, as any non-tip objects would
have already caused us to die.

We can fix that by using parse_object instead of
lookup_object, which will load the object from disk if it
has not already been loaded.

We still need to check that parse_object does not return
NULL, though, as it is possible we do not have the object
at all. A more appropriate error message would be "no such
object" rather than "not our ref"; however, we do not want
to leak information about what objects are or are not in
the object database, so we continue to use the same "not
our ref" message that would be produced by an unreachable
object.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>upload-pack: make sure "want" objects are parsed</title>
<updated>2013-03-17T05:16:56Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-03-16T10:27:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=06f15bf1f340f37293b471d8556842d4e89ff63f'/>
<id>urn:sha1:06f15bf1f340f37293b471d8556842d4e89ff63f</id>
<content type='text'>
When upload-pack receives a "want" line from the client, it
adds it to an object array. We call lookup_object to find
the actual object, which will only check for objects already
in memory. This works because we are expecting to find
objects that we already loaded during the ref advertisement.

We use the resulting object structs for a variety of
purposes. Some of them care only about the object flags, but
others care about the type of the object (e.g.,
ok_to_give_up), or even feed them to the revision parser
(when --depth is used), which assumes that objects it
receives are fully parsed.

Once upon a time, this was OK; any object we loaded into
memory would also have been parsed. But since 435c833
(upload-pack: use peel_ref for ref advertisements,
2012-10-04), we try to avoid parsing objects during the ref
advertisement. This means that lookup_object may return an
object with a type of OBJ_NONE. The resulting mess depends
on the exact set of objects, but can include the revision
parser barfing, or the shallow code sending the wrong set of
objects.

This patch teaches upload-pack to parse each "want" object
as we receive it. We do not replace the lookup_object call
with parse_object, as the current code is careful not to let
just any object appear on a "want" line, but rather only one
we have previously advertised (whereas parse_object would
actually load any arbitrary object from disk).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>upload-pack: drop lookup-before-parse optimization</title>
<updated>2013-03-17T05:16:45Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-03-16T10:25:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a6eec1263883ce9787a354e1635b7b732e72c3c9'/>
<id>urn:sha1:a6eec1263883ce9787a354e1635b7b732e72c3c9</id>
<content type='text'>
When we receive a "have" line from the client, we want to
load the object pointed to by the sha1. However, we are
careful to do:

  o = lookup_object(sha1);
  if (!o || !o-&gt;parsed)
	  o = parse_object(sha1);

to avoid loading the object from disk if we have already
seen it.  However, since ccdc603 (parse_object: try internal
cache before reading object db), parse_object already does
this optimization internally. We can just call parse_object
directly.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/hidden-refs'</title>
<updated>2013-02-17T23:25:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-02-17T23:25:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ce735bf7fd66c6404e86e5a313f35abc0394b838'/>
<id>urn:sha1:ce735bf7fd66c6404e86e5a313f35abc0394b838</id>
<content type='text'>
Allow the server side to redact the refs/ namespace it shows to the
client.

Will merge to 'master'.

* jc/hidden-refs:
  upload/receive-pack: allow hiding ref hierarchies
  upload-pack: simplify request validation
  upload-pack: share more code
</content>
</entry>
<entry>
<title>upload/receive-pack: allow hiding ref hierarchies</title>
<updated>2013-02-07T21:48:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-19T00:08:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=daebaa78137d59693a808c1f0bdec0ecb40fc12e'/>
<id>urn:sha1:daebaa78137d59693a808c1f0bdec0ecb40fc12e</id>
<content type='text'>
A repository may have refs that are only used for its internal
bookkeeping purposes that should not be exposed to the others that
come over the network.

Teach upload-pack to omit some refs from its initial advertisement
by paying attention to the uploadpack.hiderefs multi-valued
configuration variable.  Do the same to receive-pack via the
receive.hiderefs variable.  As a convenient short-hand, allow using
transfer.hiderefs to set the value to both of these variables.

Any ref that is under the hierarchies listed on the value of these
variable is excluded from responses to requests made by "ls-remote",
"fetch", etc. (for upload-pack) and "push" (for receive-pack).

Because these hidden refs do not count as OUR_REF, an attempt to
fetch objects at the tip of them will be rejected, and because these
refs do not get advertised, "git push :" will not see local branches
that have the same name as them as "matching" ones to be sent.

An attempt to update/delete these hidden refs with an explicit
refspec, e.g. "git push origin :refs/hidden/22", is rejected.  This
is not a new restriction.  To the pusher, it would appear that there
is no such ref, so its push request will conclude with "Now that I
sent you all the data, it is time for you to update the refs.  I saw
that the ref did not exist when I started pushing, and I want the
result to point at this commit".  The receiving end will apply the
compare-and-swap rule to this request and rejects the push with
"Well, your update request conflicts with somebody else; I see there
is such a ref.", which is the right thing to do. Otherwise a push to
a hidden ref will always be "the last one wins", which is not a good
default.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/fetch-depth-is-broken'</title>
<updated>2013-02-01T20:39:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-02-01T20:39:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2532d891a4aab003a5ce19f04509fd8549754485'/>
<id>urn:sha1:2532d891a4aab003a5ce19f04509fd8549754485</id>
<content type='text'>
"git fetch --depth" was broken in at least three ways.  The
resulting history was deeper than specified by one commit, it was
unclear how to wipe the shallowness of the repository with the
command, and documentation was misleading.

* nd/fetch-depth-is-broken:
  fetch: elaborate --depth action
  upload-pack: fix off-by-one depth calculation in shallow clone
  fetch: add --unshallow for turning shallow repo into complete one
</content>
</entry>
<entry>
<title>upload-pack: simplify request validation</title>
<updated>2013-01-29T05:05:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-29T04:45:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3f1da57fffdcfb48bd8b85da347f310b955245d7'/>
<id>urn:sha1:3f1da57fffdcfb48bd8b85da347f310b955245d7</id>
<content type='text'>
Long time ago, we used to punt on a large (read: asking for more
than 256 refs) fetch request and instead sent a full pack, because
we couldn't fit many refs on the command line of rev-list we run
internally to enumerate the objects to be sent.  To fix this,
565ebbf (upload-pack: tighten request validation., 2005-10-24),
added a check to count the number of refs in the request and matched
with the number of refs we advertised, and changed the invocation of
rev-list to pass "--all" to it, still keeping us under the command
line argument limit.

However, these days we feed the list of objects requested and the
list of objects the other end is known to have via standard input,
so there is no longer a valid reason to special case a full clone
request.  Remove the code associated with "create_full_pack" to
simplify the logic.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>upload-pack: share more code</title>
<updated>2013-01-18T23:48:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-18T23:48:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbbe50db7691cd9d7d261ebc5c5ffec55f93127d'/>
<id>urn:sha1:cbbe50db7691cd9d7d261ebc5c5ffec55f93127d</id>
<content type='text'>
We mark the objects pointed at our refs with "OUR_REF" flag in two
functions (mark_our_ref() and send_ref()), but we can just use the
former as a helper for the latter.

Update the way mark_our_ref() prepares in-core object to use
lookup_unknown_object() to delay reading the actual object data,
just like we did in 435c833 (upload-pack: use peel_ref for ref
advertisements, 2012-10-04).

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/upload-pack-shallow-must-be-commit'</title>
<updated>2013-01-14T16:15:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-01-14T16:15:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e43171a4a728f627aed7a7b4682e6da2cb378253'/>
<id>urn:sha1:e43171a4a728f627aed7a7b4682e6da2cb378253</id>
<content type='text'>
A minor consistency check patch that does not have much relevance
to the real world.

* nd/upload-pack-shallow-must-be-commit:
  upload-pack: only accept commits from "shallow" line
</content>
</entry>
</feed>
