rebase -i: rewrite setup_reflog_action() in C
[gitweb.git] / advice.c
index 370a56d0546bb3fc7aa4a62203c600e9a8af2d7a..52aa85bdfd9e9054c24445f259125bc4b81be038 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "config.h"
 #include "color.h"
+#include "help.h"
 
 int advice_push_update_rejected = 1;
 int advice_push_non_ff_current = 1;
@@ -16,6 +17,7 @@ int advice_implicit_identity = 1;
 int advice_detached_head = 1;
 int advice_set_upstream_failure = 1;
 int advice_object_name_warning = 1;
+int advice_amworkdir = 1;
 int advice_rm_hints = 1;
 int advice_add_embedded_repo = 1;
 int advice_ignored_hook = 1;
@@ -53,28 +55,29 @@ static struct {
        const char *name;
        int *preference;
 } advice_config[] = {
-       { "pushupdaterejected", &advice_push_update_rejected },
-       { "pushnonffcurrent", &advice_push_non_ff_current },
-       { "pushnonffmatching", &advice_push_non_ff_matching },
-       { "pushalreadyexists", &advice_push_already_exists },
-       { "pushfetchfirst", &advice_push_fetch_first },
-       { "pushneedsforce", &advice_push_needs_force },
-       { "statushints", &advice_status_hints },
-       { "statusuoption", &advice_status_u_option },
-       { "commitbeforemerge", &advice_commit_before_merge },
-       { "resolveconflict", &advice_resolve_conflict },
-       { "implicitidentity", &advice_implicit_identity },
-       { "detachedhead", &advice_detached_head },
-       { "setupstreamfailure", &advice_set_upstream_failure },
-       { "objectnamewarning", &advice_object_name_warning },
-       { "rmhints", &advice_rm_hints },
-       { "addembeddedrepo", &advice_add_embedded_repo },
-       { "ignoredhook", &advice_ignored_hook },
-       { "waitingforeditor", &advice_waiting_for_editor },
-       { "graftfiledeprecated", &advice_graft_file_deprecated },
+       { "pushUpdateRejected", &advice_push_update_rejected },
+       { "pushNonFFCurrent", &advice_push_non_ff_current },
+       { "pushNonFFMatching", &advice_push_non_ff_matching },
+       { "pushAlreadyExists", &advice_push_already_exists },
+       { "pushFetchFirst", &advice_push_fetch_first },
+       { "pushNeedsForce", &advice_push_needs_force },
+       { "statusHints", &advice_status_hints },
+       { "statusUoption", &advice_status_u_option },
+       { "commitBeforeMerge", &advice_commit_before_merge },
+       { "resolveConflict", &advice_resolve_conflict },
+       { "implicitIdentity", &advice_implicit_identity },
+       { "detachedHead", &advice_detached_head },
+       { "setupStreamFailure", &advice_set_upstream_failure },
+       { "objectNameWarning", &advice_object_name_warning },
+       { "amWorkDir", &advice_amworkdir },
+       { "rmHints", &advice_rm_hints },
+       { "addEmbeddedRepo", &advice_add_embedded_repo },
+       { "ignoredHook", &advice_ignored_hook },
+       { "waitingForEditor", &advice_waiting_for_editor },
+       { "graftFileDeprecated", &advice_graft_file_deprecated },
 
        /* make this an alias for backward compatibility */
-       { "pushnonfastforward", &advice_push_update_rejected }
+       { "pushNonFastForward", &advice_push_update_rejected }
 };
 
 void advise(const char *advice, ...)
@@ -122,7 +125,7 @@ int git_default_advice_config(const char *var, const char *value)
                return 0;
 
        for (i = 0; i < ARRAY_SIZE(advice_config); i++) {
-               if (strcmp(k, advice_config[i].name))
+               if (strcasecmp(k, advice_config[i].name))
                        continue;
                *advice_config[i].preference = git_config_bool(var, value);
                return 0;
@@ -131,6 +134,14 @@ int git_default_advice_config(const char *var, const char *value)
        return 0;
 }
 
+void list_config_advices(struct string_list *list, const char *prefix)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(advice_config); i++)
+               list_config_item(list, prefix, advice_config[i].name);
+}
+
 int error_resolve_conflict(const char *me)
 {
        if (!strcmp(me, "cherry-pick"))