Code

Read cvsimport options from repo-config
[git.git] / wt-status.c
index a8499517742d76a8d2142347d60ad1cecc6336cb..5567868008ce332d9e9ee42b586ab838bad228e6 100644 (file)
@@ -302,9 +302,18 @@ void wt_status_print(struct wt_status *s)
        unsigned char sha1[20];
        s->is_initial = get_sha1(s->reference, sha1) ? 1 : 0;
 
-       if (s->branch)
+       if (s->branch) {
+               const char *on_what = "On branch ";
+               const char *branch_name = s->branch;
+               if (!strncmp(branch_name, "refs/heads/", 11))
+                       branch_name += 11;
+               else if (!strcmp(branch_name, "HEAD")) {
+                       branch_name = "";
+                       on_what = "Not currently on any branch.";
+               }
                color_printf_ln(color(WT_STATUS_HEADER),
-                       "# On branch %s", s->branch);
+                       "# %s%s", on_what, branch_name);
+       }
 
        if (s->is_initial) {
                color_printf_ln(color(WT_STATUS_HEADER), "#");
@@ -326,7 +335,7 @@ void wt_status_print(struct wt_status *s)
                if (s->amend)
                        printf("# No changes\n");
                else if (s->workdir_dirty)
-                       printf("no changes added to commit (use \"git add\" and/or \"git commit [-a|-i|-o]\")\n");
+                       printf("no changes added to commit (use \"git add\" and/or \"git commit -a\")\n");
                else if (s->workdir_untracked)
                        printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
                else if (s->is_initial)
@@ -342,7 +351,7 @@ int git_status_config(const char *k, const char *v)
                wt_status_use_color = git_config_colorbool(k, v);
                return 0;
        }
-       if (!strncmp(k, "status.color.", 13) || !strncmp(k, "color.status", 13)) {
+       if (!strncmp(k, "status.color.", 13) || !strncmp(k, "color.status.", 13)) {
                int slot = parse_status_slot(k, 13);
                color_parse(v, k, wt_status_colors[slot]);
        }