]> git.ipfire.org Git - thirdparty/git.git/commit - upload-pack.c
upload-pack: switch deepen-not list to an oid_array
authorJeff King <peff@peff.net>
Wed, 28 Feb 2024 22:37:20 +0000 (17:37 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Feb 2024 22:42:01 +0000 (14:42 -0800)
commit720ba25d993423ab7b12b9bbdc62dadaa78d315e
treebcbba21bc9ad98f76a48e8aa96a5a89df84aabdf
parentfae9627470615df5d40f2892e518447058567316
upload-pack: switch deepen-not list to an oid_array

When we see a "deepen-not" line from the client, we verify that the
given name can be resolved as a ref, and then add it to a string list to
be passed later to an internal "rev-list --not" traversal. We record the
actual refname in the string list (so the traversal resolves it again
later), but we'd be better off recording the resolved oid:

  1. There's a tiny bit of wasted work in resolving it twice.

  2. There's a small race condition with simultaneous updates; the later
     traversal may resolve to a different value (or not at all). This
     shouldn't cause any bad behavior (we do not care about the value
     in this first resolution, so whatever value rev-list gets is OK)
     but it could mean a confusing error message (if upload-pack fails
     to resolve the ref it produces a useful message, but a failing
     traversal later results in just "revision walk setup failed").

  3. It makes it simpler to de-duplicate the results. We don't de-dup at
     all right now, but we will in the next patch.

>From the client's perspective the behavior should be the same.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
upload-pack.c