Thread (67 messages) flat view 67 messages, 6 authors, 2021-10-01

Re: [PATCH 8/8] builtin/repack.c: pass `--refs-snapshot` when writing bitmaps

From: Jeff King <hidden>
Date: 2021-09-14 18:55:07

On Sat, Sep 11, 2021 at 12:51:24PM -0400, Taylor Blau wrote:
quoted
quoted
quoted
+	fprintf(data->f->fp, "%s%s\n", data->preferred ? "+" : "",
+		oid_to_hex(oid));
Just an idea: Maybe the file could be lines of "+\tOID\n" instead of
"+OID\n"? Lends itself more naturally to extension, use with the likes
of string_list_split() etc.
Actually, even better a format like:

    "OID[\t+]\n"

Or

    "OID[\tpreferred=1]\n"
Sure, but I admit that I'm a little torn on this suggestion. I don't
want to be naive and say that we're never going to change this format
and paint ourselves into a corner.

On the other hand, changing it does seem extremely unlikely to me, and
this tab-delimited thing feels like overkill compared to how simple the
'+' format is.

So, I don't know. It's certainly easy enough to change now before we
lock it in, so I guess we should.
I'm not sure I really see the point of making this infinitely
extensible. This is mostly an internal interface between two Git
programs. Sure, it's exposed to the user in the sense that they can use
--refs-snapshot themselves. But if some writer wants to add a "foo"
flag, do they really want to be able to do it in a way that they're
_syntactically_ compatible with the older versions of Git, yet have no
clue if their option was actually recognized and accepted?

I.e., if we later add such a flag, then:

  +OID\tfoo
  +\tOID\tfoo
  OID\t+\tfoo

does not seem to make a big difference. We will likely add a new
command-line option to say "by the way, I am passing you some extra
information" at which point the format can be whatever we like.

And unless it is really complicated, I'd just as soon use a
single-character marker again, because it's dead-simple to generate and
parse (and again, this is an internal interface and not something we
expect users to have to understand).

Unless we think the "+" is too ugly or confusing, but I don't. The "-"
prefix for pack-objects read_object_list_from_stdin() is similar and
works just fine. For that matter, the --stdin-packs feature there works
similarly. Everything more feels a bit like over-engineering at this
point.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help