MCPcopy Create free account
hub / github.com/git/git / compute_default_attr_source

Function compute_default_attr_source

attr.c:1201–1231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1199}
1200
1201static int compute_default_attr_source(struct object_id *attr_source)
1202{
1203 int ignore_bad_attr_tree = 0;
1204
1205 if (!default_attr_source_tree_object_name)
1206 default_attr_source_tree_object_name = getenv(GIT_ATTR_SOURCE_ENVIRONMENT);
1207
1208 if (!default_attr_source_tree_object_name && git_attr_tree) {
1209 default_attr_source_tree_object_name = git_attr_tree;
1210 ignore_bad_attr_tree = 1;
1211 }
1212
1213 if (!default_attr_source_tree_object_name)
1214 return 0;
1215
1216 if (!startup_info->have_repository) {
1217 if (!ignore_bad_attr_tree)
1218 die(_("cannot use --attr-source or GIT_ATTR_SOURCE without repo"));
1219 return 0;
1220 }
1221
1222 if (repo_get_oid_treeish(the_repository,
1223 default_attr_source_tree_object_name,
1224 attr_source)) {
1225 if (!ignore_bad_attr_tree)
1226 die(_("bad --attr-source or GIT_ATTR_SOURCE"));
1227 return 0;
1228 }
1229
1230 return 1;
1231}
1232
1233static struct object_id *default_attr_source(void)
1234{

Callers 1

default_attr_sourceFunction · 0.85

Calls 2

repo_get_oid_treeishFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected