]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ty/migrate-trust-executable-bit'
authorJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:32:02 +0000 (10:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jul 2026 17:32:02 +0000 (10:32 -0700)
The 'trust_executable_bit' (coming from the 'core.filemode'
configuration) has been migrated into 'struct repo_config_values' to
tie it to a specific repository instance.

* ty/migrate-trust-executable-bit:
  environment: move has_symlinks into repo_config_values
  environment: move trust_executable_bit into repo_config_values
  read-cache: pass 'repo' to 'ce_mode_from_stat()'
  read-cache: remove redundant extern declarations

1  2 
apply.c
builtin/update-index.c
combine-diff.c
compat/mingw.c
entry.c
environment.c
environment.h
read-cache.c

diff --cc apply.c
Simple merge
Simple merge
diff --cc combine-diff.c
Simple merge
diff --cc compat/mingw.c
Simple merge
diff --cc entry.c
Simple merge
diff --cc environment.c
index c663113e8a6dcc4f87ed1db320db6ba4867281da,e351043446001d2ba6045427b02e930fef585614..1734220d5926b8aca7aedd2a6079a2183abb31a9
  static int pack_compression_seen;
  static int zlib_compression_seen;
  
- int trust_executable_bit = 1;
- int has_symlinks = 1;
 -int trust_ctime = 1;
 -int check_stat = 1;
  int minimum_abbrev = 4, default_abbrev = -1;
 -int ignore_case;
  int assume_unchanged;
 -int is_bare_repository_cfg = -1; /* unspecified */
 -int warn_on_object_refname_ambiguity = 1;
  char *git_commit_encoding;
  char *git_log_output_encoding;
  char *apply_default_whitespace;
@@@ -121,33 -134,26 +119,47 @@@ const char *getenv_safe(struct strvec *
        return argv->v[argv->nr - 1];
  }
  
 -int is_bare_repository(void)
 +int is_bare_repository(struct repository *repo)
  {
        /* if core.bare is not 'false', let's see if there is a work tree */
 -      return is_bare_repository_cfg && !repo_get_work_tree(the_repository);
 +      return repo->bare_cfg && !repo_get_work_tree(repo);
 +}
 +
 +int repo_protect_ntfs(struct repository *repo)
 +{
 +      return (repo && repo->initialized) ?
 +              repo_config_values(repo)->protect_ntfs :
 +              PROTECT_NTFS_DEFAULT;
 +}
 +
 +int repo_protect_hfs(struct repository *repo)
 +{
 +      return (repo && repo->initialized) ?
 +              repo_config_values(repo)->protect_hfs :
 +              PROTECT_HFS_DEFAULT;
 +}
 +
 +int repo_ignore_case(struct repository *repo)
 +{
 +      return (repo && repo->initialized) ?
 +              repo_config_values(repo)->ignore_case :
 +              0;
  }
  
+ int repo_trust_executable_bit(struct repository *repo)
+ {
+       return repo->initialized
+               ? repo_config_values(repo)->trust_executable_bit
+               : 1;
+ }
+ int repo_has_symlinks(struct repository *repo)
+ {
+       return repo->initialized
+               ? repo_config_values(repo)->has_symlinks
+               : platform_has_symlinks();
+ }
  int have_git_dir(void)
  {
        return startup_info->have_repository
@@@ -730,16 -733,7 +743,18 @@@ void repo_config_values_init(struct rep
  {
        cfg->attributes_file = NULL;
        cfg->apply_sparse_checkout = 0;
 +      cfg->protect_hfs = PROTECT_HFS_DEFAULT;
 +      cfg->protect_ntfs = PROTECT_NTFS_DEFAULT;
 +      cfg->ignore_case = 0;
+       cfg->trust_executable_bit = 1;
+       cfg->has_symlinks = platform_has_symlinks();
        cfg->branch_track = BRANCH_TRACK_REMOTE;
 +      cfg->trust_ctime = 1;
 +      cfg->check_stat = 1;
 +      cfg->zlib_compression_level = Z_BEST_SPEED;
 +      cfg->pack_compression_level = Z_DEFAULT_COMPRESSION;
 +      cfg->precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
 +      cfg->core_sparse_checkout_cone = 0;
 +      cfg->sparse_expect_files_outside_of_patterns = 0;
 +      cfg->warn_on_object_refname_ambiguity = 1;
  }
diff --cc environment.h
index acfb670be107a0c2ab35b7396a1506902c65b920,8f54c481e92a06d1f4076b67047a8b8da130cb1e..d7b830f7e1dfbac578ad7f00be5ff1eb2f3dd1a3
@@@ -91,20 -91,9 +91,22 @@@ struct repo_config_values 
        /* section "core" config values */
        char *attributes_file;
        int apply_sparse_checkout;
 +      int trust_ctime;
 +      int check_stat;
 +      int zlib_compression_level;
 +      int pack_compression_level;
 +      int precomposed_unicode;
 +      int core_sparse_checkout_cone;
 +      int warn_on_object_refname_ambiguity;
 +      int protect_hfs;
 +      int protect_ntfs;
 +      int ignore_case;
+       int trust_executable_bit;
+       int has_symlinks;
  
 +      /* section "sparse" config values */
 +      int sparse_expect_files_outside_of_patterns;
 +
        /* section "branch" config values */
        enum branch_track branch_track;
  };
@@@ -136,25 -125,12 +138,29 @@@ int git_default_config(const char *, co
  int git_default_core_config(const char *var, const char *value,
                            const struct config_context *ctx, void *cb);
  
 +/*
 + * Getters for the `protect_hfs` and `protect_ntfs` fields of `struct repo_config_values`.
 + * They check `repo->initialized` to prevent calling `repo_config_values()`
 + * before the repository setup is fully complete or in non-git environments.
 + */
 +int repo_protect_hfs(struct repository *repo);
 +int repo_protect_ntfs(struct repository *repo);
 +
 +/*
 + * Getter for the `ignore_case` field of `struct repo_config_values`.
 + * It checks `repo->initialized` to prevent calling repo_config_values()`
 + * before the repository setup is fully complete or in non-git environments.
 + */
 +int repo_ignore_case(struct repository *repo);
 +
+ int repo_trust_executable_bit(struct repository *repo);
+ int repo_has_symlinks(struct repository *repo);
  void repo_config_values_init(struct repo_config_values *cfg);
  
 +int is_bare_repository(struct repository *repo);
 +
  /*
   * TODO: All the below state either explicitly or implicitly relies on
   * `the_repository`. We should eventually get rid of these and make the
   */
  int have_git_dir(void);
  
 -extern int is_bare_repository_cfg;
 -int is_bare_repository(void);
 -extern char *git_work_tree_cfg;
 -
  /* Environment bits from configuration mechanism */
- extern int trust_executable_bit;
- extern int has_symlinks;
 -extern int trust_ctime;
 -extern int check_stat;
  extern int minimum_abbrev, default_abbrev;
 -extern int ignore_case;
  extern int assume_unchanged;
 -extern int warn_on_object_refname_ambiguity;
  extern char *apply_default_whitespace;
  extern char *apply_default_ignorewhitespace;
 -extern int zlib_compression_level;
 -extern int pack_compression_level;
  extern unsigned long pack_size_limit_cfg;
  
 -extern int precomposed_unicode;
 -extern int protect_hfs;
 -extern int protect_ntfs;
 -
 -extern int core_sparse_checkout_cone;
 -extern int sparse_expect_files_outside_of_patterns;
 -
  enum rebase_setup_type {
        AUTOREBASE_NEVER = 0,
        AUTOREBASE_LOCAL,
diff --cc read-cache.c
Simple merge