diff options
author | John Cai <johncai86@gmail.com> | 2023-10-13 19:39:30 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-10-13 20:43:29 +0200 |
commit | 9f9c40cf34c29d4ad700d9869435d159056fa6fb (patch) | |
tree | 8e3b138390a996f68831accaeebe2fb9488f2382 /config.c | |
parent | attr: read attributes from HEAD when bare repo (diff) | |
download | git-9f9c40cf34c29d4ad700d9869435d159056fa6fb.tar.xz git-9f9c40cf34c29d4ad700d9869435d159056fa6fb.zip |
attr: add attr.tree for setting the treeish to read attributes from
44451a2 (attr: teach "--attr-source=<tree>" global option to "git",
2023-05-06) provided the ability to pass in a treeish as the attr
source. In the context of serving Git repositories as bare repos like we
do at GitLab however, it would be easier to point --attr-source to HEAD
for all commands by setting it once.
Add a new config attr.tree that allows this.
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -18,6 +18,7 @@ #include "repository.h" #include "lockfile.h" #include "mailmap.h" +#include "attr.h" #include "exec-cmd.h" #include "strbuf.h" #include "quote.h" @@ -1904,6 +1905,18 @@ static int git_default_mailmap_config(const char *var, const char *value) return 0; } +static int git_default_attr_config(const char *var, const char *value) +{ + if (!strcmp(var, "attr.tree")) + return git_config_string(&git_attr_tree, var, value); + + /* + * Add other attribute related config variables here and to + * Documentation/config/attr.txt. + */ + return 0; +} + int git_default_config(const char *var, const char *value, const struct config_context *ctx, void *cb) { @@ -1927,6 +1940,9 @@ int git_default_config(const char *var, const char *value, if (starts_with(var, "mailmap.")) return git_default_mailmap_config(var, value); + if (starts_with(var, "attr.")) + return git_default_attr_config(var, value); + if (starts_with(var, "advice.") || starts_with(var, "color.advice")) return git_default_advice_config(var, value); |