Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 1 | #include "cache.h" |
| 2 | |
| 3 | int advice_push_nonfastforward = 1; |
Jeff King | edf563f | 2009-09-09 07:43:03 -0400 | [diff] [blame] | 4 | int advice_status_hints = 1; |
Matthieu Moy | 4c371f9 | 2009-11-22 23:26:17 +0100 | [diff] [blame] | 5 | int advice_commit_before_merge = 1; |
Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 6 | |
| 7 | static struct { |
| 8 | const char *name; |
| 9 | int *preference; |
| 10 | } advice_config[] = { |
| 11 | { "pushnonfastforward", &advice_push_nonfastforward }, |
Jeff King | edf563f | 2009-09-09 07:43:03 -0400 | [diff] [blame] | 12 | { "statushints", &advice_status_hints }, |
Matthieu Moy | 4c371f9 | 2009-11-22 23:26:17 +0100 | [diff] [blame] | 13 | { "commitbeforemerge", &advice_commit_before_merge }, |
Jeff King | 7519443 | 2009-09-09 07:38:58 -0400 | [diff] [blame] | 14 | }; |
| 15 | |
| 16 | int git_default_advice_config(const char *var, const char *value) |
| 17 | { |
| 18 | const char *k = skip_prefix(var, "advice."); |
| 19 | int i; |
| 20 | |
| 21 | for (i = 0; i < ARRAY_SIZE(advice_config); i++) { |
| 22 | if (strcmp(k, advice_config[i].name)) |
| 23 | continue; |
| 24 | *advice_config[i].preference = git_config_bool(var, value); |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | return 0; |
| 29 | } |