@@ -227,10 +227,8 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
* populate with sensible defaults.
*/
for (i = 0; i < ARRAY_SIZE(ref_namespace); i++) {
- if (!ref_namespace[i].decoration)
- continue;
-
- string_list_append(include, ref_namespace[i].ref);
+ if (ref_namespace[i].include)
+ string_list_append(include, ref_namespace[i].ref);
}
}
@@ -70,14 +70,17 @@ struct ref_namespace_info ref_namespace[] = {
.ref = "HEAD",
.decoration = DECORATION_REF_HEAD,
.exact = 1,
+ .include = 1,
},
[NAMESPACE_BRANCHES] = {
.ref = "refs/heads/",
.decoration = DECORATION_REF_LOCAL,
+ .include = 1,
},
[NAMESPACE_TAGS] = {
.ref = "refs/tags/",
.decoration = DECORATION_REF_TAG,
+ .include = 1,
},
[NAMESPACE_REMOTE_REFS] = {
/*
@@ -87,6 +90,7 @@ struct ref_namespace_info ref_namespace[] = {
*/
.ref = "refs/remotes/",
.decoration = DECORATION_REF_REMOTE,
+ .include = 1,
},
[NAMESPACE_STASH] = {
/*
@@ -96,6 +100,7 @@ struct ref_namespace_info ref_namespace[] = {
.ref = "refs/stash",
.exact = 1,
.decoration = DECORATION_REF_STASH,
+ .include = 1,
},
[NAMESPACE_REPLACE] = {
/*
@@ -107,6 +112,7 @@ struct ref_namespace_info ref_namespace[] = {
*/
.ref = "refs/replace/",
.decoration = DECORATION_GRAFTED,
+ .include = 1,
},
[NAMESPACE_NOTES] = {
/*
@@ -987,10 +987,14 @@ struct ref_namespace_info {
* If 'exact' is true, then we must match the 'ref' exactly.
* Otherwise, use a prefix match.
*
+ * If 'include' is true, the namespace is included in the
+ * default decoration filters.
+ *
* 'ref_updated' is for internal use. It represents whether the
* 'ref' value was replaced from its original literal version.
*/
unsigned exact:1,
+ include:1,
ref_updated:1;
};
Add 'include' bit to struct ref_namespace_info to determine whether a ref namespace is to be included in the default decoration filters, instead of using the decoration type for the purpose. This is to allow adding ref namespaces that do have a decoration type but that are not shown by default. Signed-off-by: Andy Koppe <andy.koppe@gmail.com> --- builtin/log.c | 6 ++---- refs.c | 6 ++++++ refs.h | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-)