1#include"cache.h" 2 3int advice_push_nonfastforward =1; 4int advice_status_hints =1; 5int advice_commit_before_merge =1; 6int advice_resolve_conflict =1; 7 8static struct{ 9const char*name; 10int*preference; 11} advice_config[] = { 12{"pushnonfastforward", &advice_push_nonfastforward }, 13{"statushints", &advice_status_hints }, 14{"commitbeforemerge", &advice_commit_before_merge }, 15{"resolveconflict", &advice_resolve_conflict }, 16}; 17 18intgit_default_advice_config(const char*var,const char*value) 19{ 20const char*k =skip_prefix(var,"advice."); 21int i; 22 23for(i =0; i <ARRAY_SIZE(advice_config); i++) { 24if(strcmp(k, advice_config[i].name)) 25continue; 26*advice_config[i].preference =git_config_bool(var, value); 27return0; 28} 29 30return0; 31} 32 33void NORETURN die_resolve_conflict(const char*me) 34{ 35if(advice_resolve_conflict) 36/* 37 * Message used both when 'git commit' fails and when 38 * other commands doing a merge do. 39 */ 40die("'%s' is not possible because you have unmerged files.\n" 41"Please, fix them up in the work tree, and then use 'git add/rm <file>' as\n" 42"appropriate to mark resolution and make a commit, or use 'git commit -a'.", me); 43else 44die("'%s' is not possible because you have unmerged files.", me); 45}