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