archive: rename archiver data field to filter_command

The void pointer "data" in struct archiver is only used to store filter commands to pass tar archives to, like gzip. Rename it accordingly and also turn it into a char pointer to document the fact that it's a string reference. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Jun 15, 2022 at 18:59 UTC 96b9e5151bf0cad110d2f0bf16f413b9fc9f606c
2 files changed +6 -6
archive-tar.c
+5 -5
@@ -383,8 +383,8 @@ static int tar_filter_config(const char *var, const char *value, void *data)
383 if (!strcmp(type, "command")) {
384 if (!value)
385 return config_error_nonbool(var);
386 - free(ar->data);
387 - ar->data = xstrdup(value);
386 + free(ar->filter_command);
387 + ar->filter_command = xstrdup(value);
388 return 0;
389 }
390 if (!strcmp(type, "remote")) {
@@ -432,10 +432,10 @@ static int write_tar_filter_archive(const struct archiver *ar,
432 struct child_process filter = CHILD_PROCESS_INIT;
433 int r;
434
435 - if (!ar->data)
435 + if (!ar->filter_command)
436 BUG("tar-filter archiver called with no filter defined");
437
438 - strbuf_addstr(&cmd, ar->data);
438 + strbuf_addstr(&cmd, ar->filter_command);
439 if (args->compression_level >= 0)
440 strbuf_addf(&cmd, " -%d", args->compression_level);
441
@@ -478,7 +478,7 @@ void init_tar_archiver(void)
478 git_config(git_tar_config, NULL);
479 for (i = 0; i < nr_tar_filters; i++) {
480 /* omit any filters that never had a command configured */
481 - if (tar_filters[i]->data)
481 + if (tar_filters[i]->filter_command)
482 register_archiver(tar_filters[i]);
483 }
484 }
archive.h
+1 -1
@@ -43,7 +43,7 @@ struct archiver {
43 const char *name;
44 int (*write_archive)(const struct archiver *, struct archiver_args *);
45 unsigned flags;
46 - void *data;
46 + char *filter_command;
47 };
48 void register_archiver(struct archiver *);
49