]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ps/refs-avoid-chdir-notify-reparent' into jch
authorJunio C Hamano <gitster@pobox.com>
Fri, 26 Jun 2026 02:49:22 +0000 (19:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Jun 2026 02:49:22 +0000 (19:49 -0700)
The reference backends have been converted to always use absolute
paths internally. This allows dropping the calls to
`chdir_notify_reparent()` and fixes a memory leak in how the
reference database is constructed with an "onbranch" condition.

* ps/refs-avoid-chdir-notify-reparent:
  refs: protect against chicken-and-egg recursion
  refs/reftable: lazy-load configuration to fix chicken-and-egg
  reftable: split up write options
  refs/files: lazy-load configuration to fix chicken-and-egg
  refs: move parsing of "core.logAllRefUpdates" back into ref stores
  repository: free main reference database
  chdir-notify: drop unused `chdir_notify_reparent()`
  refs: unregister reference stores from "chdir_notify"
  setup: don't apply "GIT_REFERENCE_BACKEND" without a repository
  setup: stop applying repository format twice
  setup: inline `check_and_apply_repository_format()`

1  2 
refs/files-backend.c
refs/reftable-backend.c
repository.c
setup.c
t/t1400-update-ref.sh

Simple merge
index c151d331e758366d663dc4f9fab61d6beeb14935,d74131a5ae0c19e2a29daded9f2689badd64e0cc..212408c769c5e6563982fa69ebf6ac93f67def4c
@@@ -1417,6 -1441,26 +1439,26 @@@ static int transaction_update_cmp(cons
        return strcmp(update_a->update->refname, update_b->update->refname);
  }
  
 -              log_refs_cfg = is_bare_repository() ? LOG_REFS_NONE : LOG_REFS_NORMAL;
+ static int should_write_log(struct reftable_ref_store *refs, const char *refname)
+ {
+       enum log_refs_config log_refs_cfg = reftable_be_write_options(refs)->log_all_ref_updates;
+       if (log_refs_cfg == LOG_REFS_UNSET)
++              log_refs_cfg = is_bare_repository(refs->base.repo) ? LOG_REFS_NONE : LOG_REFS_NORMAL;
+       switch (log_refs_cfg) {
+       case LOG_REFS_NONE:
+               return refs_reflog_exists(&refs->base, refname);
+       case LOG_REFS_ALWAYS:
+               return 1;
+       case LOG_REFS_NORMAL:
+               if (should_autocreate_reflog(log_refs_cfg, refname))
+                       return 1;
+               return refs_reflog_exists(&refs->base, refname);
+       default:
+               BUG("unhandled core.logAllRefUpdates value %d", log_refs_cfg);
+       }
+ }
  static int write_transaction_table(struct reftable_writer *writer, void *cb_data)
  {
        struct write_transaction_table_arg *arg = cb_data;
diff --cc repository.c
Simple merge
diff --cc setup.c
index 1eb7dba3676460c00b2c2cc7f66aa41e89f5c6b3,592753457c29a45bad019be5b492e1ddac2369f4..0de56a074f7c1581d705675bb02bec56a7752fab
+++ b/setup.c
@@@ -2610,13 -2581,17 +2591,17 @@@ static int create_default_files(struct 
        }
        repo_config_set(repo, "core.filemode", filemode ? "true" : "false");
  
 -      if (is_bare_repository())
 +      if (is_bare_repository(repo))
                repo_config_set(repo, "core.bare", "true");
        else {
+               const char *value;
                repo_config_set(repo, "core.bare", "false");
                /* allow template config file to override the default */
-               if (repo_settings_get_log_all_ref_updates(repo) == LOG_REFS_UNSET)
+               if (repo_config_get_string_tmp(repo, "core.logallrefupdates", &value))
                        repo_config_set(repo, "core.logallrefupdates", "true");
                if (needs_work_tree_config(original_git_dir, work_tree))
                        repo_config_set(repo, "core.worktree", work_tree);
        }
Simple merge