1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-10 08:26:10 +02:00
git/advice.c
Jeff King 75194438f4 push: make non-fast-forward help message configurable
This message is designed to help new users understand what
has happened when refs fail to push. However, it does not
help experienced users at all, and significantly clutters
the output, frequently dwarfing the regular status table and
making it harder to see.

This patch introduces a general configuration mechanism for
optional messages, with this push message as the first
example.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-11 21:33:20 -07:00

26 lines
510 B
C

#include "cache.h"
int advice_push_nonfastforward = 1;
static struct {
const char *name;
int *preference;
} advice_config[] = {
{ "pushnonfastforward", &advice_push_nonfastforward },
};
int git_default_advice_config(const char *var, const char *value)
{
const char *k = skip_prefix(var, "advice.");
int i;
for (i = 0; i < ARRAY_SIZE(advice_config); i++) {
if (strcmp(k, advice_config[i].name))
continue;
*advice_config[i].preference = git_config_bool(var, value);
return 0;
}
return 0;
}