`layout.shallow`::
`true` if this is a shallow repository, otherwise `false`.
+`object.format`::
+ The object format (hash algorithm) used in the repository.
+
`references.format`::
The reference storage format. The valid values are:
+
return 0;
}
+static int get_object_format(struct repository *repo, struct strbuf *buf)
+{
+ strbuf_addstr(buf, repo->hash_algo->name);
+ return 0;
+}
+
static int get_references_format(struct repository *repo, struct strbuf *buf)
{
strbuf_addstr(buf,
static const struct field repo_info_fields[] = {
{ "layout.bare", get_layout_bare },
{ "layout.shallow", get_layout_shallow },
+ { "object.format", get_object_format },
{ "references.format", get_references_format },
};
test_repo_info 'shallow repository = true is retrieved correctly' \
'git clone --depth 1 "file://$PWD/remote"' 'shallow' 'layout.shallow' 'true'
+test_repo_info 'object.format = sha1 is retrieved correctly' \
+ 'git init --object-format=sha1' 'sha1' 'object.format' 'sha1'
+
+test_repo_info 'object.format = sha256 is retrieved correctly' \
+ 'git init --object-format=sha256' 'sha256' 'object.format' 'sha256'
+
test_expect_success 'values returned in order requested' '
cat >expect <<-\EOF &&
layout.bare=false