git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/2] upload-pack: don't ACK non-commits repeatedly

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 5, 2025, 06:18 UTC
Message-ID
<20250905-b4-pks-upload-pack-repeated-non-commit-acks-v2-0-d2e67f3cb94c@pks.im>
In-Reply-To
<20250903-b4-pks-upload-pack-repeated-non-commit-acks-v1-0-4e019af4dddc@pks.im>
Hi,

this patch series addresses an issue with storing duplicate object IDs sent by the client in git-upload-pack(1). If the client sends repeated "have" lines for an object ID that doesn't refer to a commit, then we end up storing that object ID repeatedly in the `have_obj` array. This leads to sending out repeated "ACK"s for the same object.

The series applies on top of "maint" at c44beea485 (Git 2.51, 2025-08-17).

Changes in v2:
  - Change ordering so that we always mark parents of already-seen
    commits as `THEY_HAVE`. The first version was _probably_ fine, but
    I don't feel too comfortable with a "probably".
  - Link to v1: https://lore.kernel.org/r/20250903-b4-pks-upload-pack-repeated-non-commit-acks-v1-0-4e019af4dddc@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (2):
      t5530: modernize tests
      upload-pack: don't ACK non-commits repeatedly in protocol v2
 t/t5530-upload-pack-error.sh | 68 +++++++++++++++++++++++++++-----------------
 upload-pack.c                | 19 ++++++-------
 2 files changed, 51 insertions(+), 36 deletions(-)
Range-diff versus v1:
1:  a42d231813 = 1:  26ecbcf460 t5530: modernize tests
2:  1544160961 ! 2:  11e32bf5e6 upload-pack: don't ACK non-commits repeatedly in protocol v2
    @@ upload-pack.c: static void create_pack_file(struct upload_pack_data *pack_data,
      
      	if (!o)
      		die("oops (%s)", oid_to_hex(oid));
    -+
    -+	if (o->flags & THEY_HAVE)
    -+		return 0;
    -+	o->flags |= THEY_HAVE;
     +
      	if (o->type == OBJ_COMMIT) {
      		struct commit_list *parents;
    @@ upload-pack.c: static int do_got_oid(struct upload_pack_data *data, const struct
     -	}
     -	return 0;
     +
    ++	if (o->flags & THEY_HAVE)
    ++		return 0;
    ++	o->flags |= THEY_HAVE;
    ++
     +	add_object_array(o, NULL, &data->have_obj);
     +	return 1;
      }

--- base-commit: c44beea485f0f2feaf460e2ac87fdd5608d63cf0 change-id: 20250903-b4-pks-upload-pack-repeated-non-commit-acks-49b363e1d0e1

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 9 of 13 in “upload-pack: don't ACK non-commits repeatedly”
  1. 0/2 upload-pack: don't ACK non-commits repeatedlyPatrick Steinhardt, Sep 3, 2025
  2. 1/2 t5530: modernize testsPatrick Steinhardt, Sep 3, 2025
  3. Junio C HamanoSep 4, 2025
  4. 2/2 upload-pack: don't ACK non-commits repeatedly in protocol v2Patrick Steinhardt, Sep 3, 2025
  5. Junio C HamanoSep 4, 2025
  6. Patrick SteinhardtSep 4, 2025
  7. Junio C HamanoSep 4, 2025
  8. Patrick SteinhardtSep 5, 2025
  9. 0/2 upload-pack: don't ACK non-commits repeatedlyPatrick Steinhardt, Sep 5, 2025
  10. 1/2 t5530: modernize testsPatrick Steinhardt, Sep 5, 2025
  11. 2/2 upload-pack: don't ACK non-commits repeatedly in protocol v2Patrick Steinhardt, Sep 5, 2025
  12. Jeff KingSep 8, 2025
  13. Junio C HamanoSep 5, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.