]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ds/maintenance-part-3'
authorJunio C Hamano <gitster@pobox.com>
Tue, 8 Dec 2020 23:11:19 +0000 (15:11 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Dec 2020 23:11:19 +0000 (15:11 -0800)
"git maintenance" command had trouble working in a directory whose
pathname contained an ERE metacharacter like '+'.

* ds/maintenance-part-3:
  maintenance: use 'git config --fixed-value'

1  2 
builtin/gc.c

diff --combined builtin/gc.c
index 3e8d76fd5acd78bc2d877f696f185640e26dad84,acfd5b9cf6cc9fca00d858db023a5a4104910126..592b20fb89445c49207742b8647da8accc42a5c1
@@@ -534,7 -534,7 +534,7 @@@ int cmd_gc(int argc, const char **argv
        const char *name;
        pid_t pid;
        int daemonized = 0;
 -      int keep_base_pack = -1;
 +      int keep_largest_pack = -1;
        timestamp_t dummy;
  
        struct option builtin_gc_options[] = {
                OPT_BOOL_F(0, "force", &force,
                           N_("force running gc even if there may be another gc running"),
                           PARSE_OPT_NOCOMPLETE),
 -              OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
 +              OPT_BOOL(0, "keep-largest-pack", &keep_largest_pack,
                         N_("repack all other packs except the largest pack")),
                OPT_END()
        };
        } else {
                struct string_list keep_pack = STRING_LIST_INIT_NODUP;
  
 -              if (keep_base_pack != -1) {
 -                      if (keep_base_pack)
 +              if (keep_largest_pack != -1) {
 +                      if (keep_largest_pack)
                                find_base_packs(&keep_pack, 0);
                } else if (big_pack_threshold) {
                        find_base_packs(&keep_pack, big_pack_threshold);
@@@ -1253,8 -1253,10 +1253,8 @@@ static struct maintenance_task tasks[] 
  
  static int compare_tasks_by_selection(const void *a_, const void *b_)
  {
 -      const struct maintenance_task *a, *b;
 -
 -      a = (const struct maintenance_task *)&a_;
 -      b = (const struct maintenance_task *)&b_;
 +      const struct maintenance_task *a = a_;
 +      const struct maintenance_task *b = b_;
  
        return b->selected_order - a->selected_order;
  }
@@@ -1460,7 -1462,8 +1460,8 @@@ static int maintenance_register(void
                git_config_set("maintenance.strategy", "incremental");
  
        config_get.git_cmd = 1;
-       strvec_pushl(&config_get.args, "config", "--global", "--get", "maintenance.repo",
+       strvec_pushl(&config_get.args, "config", "--global", "--get",
+                    "--fixed-value", "maintenance.repo",
                     the_repository->worktree ? the_repository->worktree
                                              : the_repository->gitdir,
                         NULL);
@@@ -1491,7 -1494,7 +1492,7 @@@ static int maintenance_unregister(void
  
        config_unset.git_cmd = 1;
        strvec_pushl(&config_unset.args, "config", "--global", "--unset",
-                    "maintenance.repo",
+                    "--fixed-value", "maintenance.repo",
                     the_repository->worktree ? the_repository->worktree
                                              : the_repository->gitdir,
                     NULL);