Code

git-svn: cleanup: move editor-specific variables into the editor namespace
[git.git] / wt-status.c
index daba9a6105882c671edd7da21f0a9ae34fbdaaa4..035e546ed77248720813e7c42e0e2b25f5e760a3 100644 (file)
@@ -47,17 +47,10 @@ void wt_status_prepare(struct wt_status *s)
        unsigned char sha1[20];
        const char *head;
 
+       memset(s, 0, sizeof(*s));
        head = resolve_ref("HEAD", sha1, 0, NULL);
        s->branch = head ? xstrdup(head) : NULL;
-
        s->reference = "HEAD";
-       s->amend = 0;
-       s->verbose = 0;
-       s->untracked = 0;
-
-       s->commitable = 0;
-       s->workdir_dirty = 0;
-       s->workdir_untracked = 0;
 }
 
 static void wt_status_print_cached_header(const char *reference)
@@ -305,7 +298,7 @@ void wt_status_print(struct wt_status *s)
        if (s->branch) {
                const char *on_what = "On branch ";
                const char *branch_name = s->branch;
-               if (!strncmp(branch_name, "refs/heads/", 11))
+               if (!prefixcmp(branch_name, "refs/heads/"))
                        branch_name += 11;
                else if (!strcmp(branch_name, "HEAD")) {
                        branch_name = "";
@@ -335,7 +328,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)
@@ -351,7 +344,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 (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
                int slot = parse_status_slot(k, 13);
                color_parse(v, k, wt_status_colors[slot]);
        }