Revert "trailer: rename *_DEFAULT enums to *_UNSPECIFIED"

This reverts commit d2be104085, which
was premature.  It will be replaced with an updated patch.
This commit is contained in:
Junio C Hamano
2023-09-22 16:16:42 -07:00
parent 730a981d04
commit a519df3a42
2 changed files with 10 additions and 13 deletions

View File

@ -388,7 +388,7 @@ static void process_trailers_lists(struct list_head *head,
int trailer_set_where(enum trailer_where *item, const char *value) int trailer_set_where(enum trailer_where *item, const char *value)
{ {
if (!value) if (!value)
*item = WHERE_UNSPECIFIED; *item = WHERE_DEFAULT;
else if (!strcasecmp("after", value)) else if (!strcasecmp("after", value))
*item = WHERE_AFTER; *item = WHERE_AFTER;
else if (!strcasecmp("before", value)) else if (!strcasecmp("before", value))
@ -405,7 +405,7 @@ int trailer_set_where(enum trailer_where *item, const char *value)
int trailer_set_if_exists(enum trailer_if_exists *item, const char *value) int trailer_set_if_exists(enum trailer_if_exists *item, const char *value)
{ {
if (!value) if (!value)
*item = EXISTS_UNSPECIFIED; *item = EXISTS_DEFAULT;
else if (!strcasecmp("addIfDifferent", value)) else if (!strcasecmp("addIfDifferent", value))
*item = EXISTS_ADD_IF_DIFFERENT; *item = EXISTS_ADD_IF_DIFFERENT;
else if (!strcasecmp("addIfDifferentNeighbor", value)) else if (!strcasecmp("addIfDifferentNeighbor", value))
@ -424,7 +424,7 @@ int trailer_set_if_exists(enum trailer_if_exists *item, const char *value)
int trailer_set_if_missing(enum trailer_if_missing *item, const char *value) int trailer_set_if_missing(enum trailer_if_missing *item, const char *value)
{ {
if (!value) if (!value)
*item = MISSING_UNSPECIFIED; *item = MISSING_DEFAULT;
else if (!strcasecmp("doNothing", value)) else if (!strcasecmp("doNothing", value))
*item = MISSING_DO_NOTHING; *item = MISSING_DO_NOTHING;
else if (!strcasecmp("add", value)) else if (!strcasecmp("add", value))
@ -586,10 +586,7 @@ static void ensure_configured(void)
if (configured) if (configured)
return; return;
/* /* Default config must be setup first */
* Default config must be setup first. These defaults are used if there
* are no "trailer.*" or "trailer.<token>.*" options configured.
*/
default_conf_info.where = WHERE_END; default_conf_info.where = WHERE_END;
default_conf_info.if_exists = EXISTS_ADD_IF_DIFFERENT_NEIGHBOR; default_conf_info.if_exists = EXISTS_ADD_IF_DIFFERENT_NEIGHBOR;
default_conf_info.if_missing = MISSING_ADD; default_conf_info.if_missing = MISSING_ADD;
@ -704,11 +701,11 @@ static void add_arg_item(struct list_head *arg_head, char *tok, char *val,
new_item->value = val; new_item->value = val;
duplicate_conf(&new_item->conf, conf); duplicate_conf(&new_item->conf, conf);
if (new_trailer_item) { if (new_trailer_item) {
if (new_trailer_item->where != WHERE_UNSPECIFIED) if (new_trailer_item->where != WHERE_DEFAULT)
new_item->conf.where = new_trailer_item->where; new_item->conf.where = new_trailer_item->where;
if (new_trailer_item->if_exists != EXISTS_UNSPECIFIED) if (new_trailer_item->if_exists != EXISTS_DEFAULT)
new_item->conf.if_exists = new_trailer_item->if_exists; new_item->conf.if_exists = new_trailer_item->if_exists;
if (new_trailer_item->if_missing != MISSING_UNSPECIFIED) if (new_trailer_item->if_missing != MISSING_DEFAULT)
new_item->conf.if_missing = new_trailer_item->if_missing; new_item->conf.if_missing = new_trailer_item->if_missing;
} }
list_add_tail(&new_item->list, arg_head); list_add_tail(&new_item->list, arg_head);

View File

@ -5,14 +5,14 @@
#include "strbuf.h" #include "strbuf.h"
enum trailer_where { enum trailer_where {
WHERE_UNSPECIFIED, WHERE_DEFAULT,
WHERE_END, WHERE_END,
WHERE_AFTER, WHERE_AFTER,
WHERE_BEFORE, WHERE_BEFORE,
WHERE_START WHERE_START
}; };
enum trailer_if_exists { enum trailer_if_exists {
EXISTS_UNSPECIFIED, EXISTS_DEFAULT,
EXISTS_ADD_IF_DIFFERENT_NEIGHBOR, EXISTS_ADD_IF_DIFFERENT_NEIGHBOR,
EXISTS_ADD_IF_DIFFERENT, EXISTS_ADD_IF_DIFFERENT,
EXISTS_ADD, EXISTS_ADD,
@ -20,7 +20,7 @@ enum trailer_if_exists {
EXISTS_DO_NOTHING EXISTS_DO_NOTHING
}; };
enum trailer_if_missing { enum trailer_if_missing {
MISSING_UNSPECIFIED, MISSING_DEFAULT,
MISSING_ADD, MISSING_ADD,
MISSING_DO_NOTHING MISSING_DO_NOTHING
}; };