Thread (47 messages) flat view 47 messages, 2 authors, 2020-07-24

Re: [PATCH v3 30/39] builtin/verify-pack: implement an --object-format option

From: Eric Sunshine <hidden>
Date: 2020-07-23 04:54:38

On Wed, Jul 22, 2020 at 9:10 PM brian m. carlson
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
Since we're not in a repository here, we need to provide git verify-pack
help to set things up properly.  git index-pack already knows an
--object-format option, so let's accept one as well and pass it down to
our git index-pack invocation.  Since this argument is optional, let's
dynamically determine the proper location to insert it into the array.
Finally, let's make t5702 pass the proper argument on down to its git
verify-pack caller.

Signed-off-by: brian m. carlson <redacted>
---
diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c
@@ -7,21 +7,27 @@
+static int verify_one_pack(const char *path, unsigned int flags, const char *hash_algo)
 {
-       const char *argv[] = {"index-pack", NULL, NULL, NULL };
+       const char *argv[] = {"index-pack", NULL, NULL, NULL, NULL };
+       int argno = 1;

+       if (hash_algo) {
+               strbuf_addf(&hash_arg, "--object-format=%s", hash_algo);
+               argv[argno++] = hash_arg.buf;
+       }
This seems like a good candidate for 'struct argv_array' (but perhaps
that's too significant a change or out of scope of this patch?).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help