travis-ci: print the "tip of branch is exactly at tag" message in color
[gitweb.git] / advice.c
index 4dc5cf10a8533b1bfc3bd1483e91df115aa8f868..d81e1cb7425b0f2d75461865b5c965a21ada5587 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "config.h"
 
 int advice_push_update_rejected = 1;
 int advice_push_non_ff_current = 1;
@@ -15,6 +16,7 @@ int advice_detached_head = 1;
 int advice_set_upstream_failure = 1;
 int advice_object_name_warning = 1;
 int advice_rm_hints = 1;
+int advice_add_embedded_repo = 1;
 
 static struct {
        const char *name;
@@ -35,6 +37,7 @@ static struct {
        { "setupstreamfailure", &advice_set_upstream_failure },
        { "objectnamewarning", &advice_object_name_warning },
        { "rmhints", &advice_rm_hints },
+       { "addembeddedrepo", &advice_add_embedded_repo },
 
        /* make this an alias for backward compatibility */
        { "pushnonfastforward", &advice_push_update_rejected }
@@ -79,7 +82,20 @@ int git_default_advice_config(const char *var, const char *value)
 
 int error_resolve_conflict(const char *me)
 {
-       error("%s is not possible because you have unmerged files.", me);
+       if (!strcmp(me, "cherry-pick"))
+               error(_("Cherry-picking is not possible because you have unmerged files."));
+       else if (!strcmp(me, "commit"))
+               error(_("Committing is not possible because you have unmerged files."));
+       else if (!strcmp(me, "merge"))
+               error(_("Merging is not possible because you have unmerged files."));
+       else if (!strcmp(me, "pull"))
+               error(_("Pulling is not possible because you have unmerged files."));
+       else if (!strcmp(me, "revert"))
+               error(_("Reverting is not possible because you have unmerged files."));
+       else
+               error(_("It is not possible to %s because you have unmerged files."),
+                       me);
+
        if (advice_resolve_conflict)
                /*
                 * Message used both when 'git commit' fails and when
@@ -93,7 +109,7 @@ int error_resolve_conflict(const char *me)
 void NORETURN die_resolve_conflict(const char *me)
 {
        error_resolve_conflict(me);
-       die("Exiting because of an unresolved conflict.");
+       die(_("Exiting because of an unresolved conflict."));
 }
 
 void NORETURN die_conclude_merge(void)
@@ -106,14 +122,14 @@ void NORETURN die_conclude_merge(void)
 
 void detach_advice(const char *new_name)
 {
-       const char fmt[] =
-       "Note: checking out '%s'.\n\n"
+       const char *fmt =
+       _("Note: checking out '%s'.\n\n"
        "You are in 'detached HEAD' state. You can look around, make experimental\n"
        "changes and commit them, and you can discard any commits you make in this\n"
        "state without impacting any branches by performing another checkout.\n\n"
        "If you want to create a new branch to retain commits you create, you may\n"
        "do so (now or later) by using -b with the checkout command again. Example:\n\n"
-       "  git checkout -b <new-branch-name>\n\n";
+       "  git checkout -b <new-branch-name>\n\n");
 
        fprintf(stderr, fmt, new_name);
 }