documentation: trivial style cleanups
[gitweb.git] / wt-status.c
index 39f888bcc8b6cb4a32442972a7649b2825dd4d3f..bf84a86ee3d6b136bd83115f0bf15a55835817fc 100644 (file)
@@ -511,9 +511,12 @@ static void wt_status_collect_untracked(struct wt_status *s)
        if (s->show_untracked_files != SHOW_ALL_UNTRACKED_FILES)
                dir.flags |=
                        DIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;
+       if (s->show_ignored_files)
+               dir.flags |= DIR_SHOW_IGNORED_TOO;
        setup_standard_excludes(&dir);
 
        fill_directory(&dir, s->pathspec);
+
        for (i = 0; i < dir.nr; i++) {
                struct dir_entry *ent = dir.entries[i];
                if (cache_name_is_other(ent->name, ent->len) &&
@@ -522,22 +525,17 @@ static void wt_status_collect_untracked(struct wt_status *s)
                free(ent);
        }
 
-       if (s->show_ignored_files) {
-               dir.nr = 0;
-               dir.flags = DIR_SHOW_IGNORED;
-               if (s->show_untracked_files != SHOW_ALL_UNTRACKED_FILES)
-                       dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
-               fill_directory(&dir, s->pathspec);
-               for (i = 0; i < dir.nr; i++) {
-                       struct dir_entry *ent = dir.entries[i];
-                       if (cache_name_is_other(ent->name, ent->len) &&
-                           match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
-                               string_list_insert(&s->ignored, ent->name);
-                       free(ent);
-               }
+       for (i = 0; i < dir.ignored_nr; i++) {
+               struct dir_entry *ent = dir.ignored[i];
+               if (cache_name_is_other(ent->name, ent->len) &&
+                   match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
+                       string_list_insert(&s->ignored, ent->name);
+               free(ent);
        }
 
        free(dir.entries);
+       free(dir.ignored);
+       clear_directory(&dir);
 
        if (advice_status_u_option) {
                struct timeval t_end;
@@ -969,7 +967,8 @@ static void show_revert_in_progress(struct wt_status *s,
                                        struct wt_status_state *state,
                                        const char *color)
 {
-       status_printf_ln(s, color, _("You are currently reverting a commit."));
+       status_printf_ln(s, color, _("You are currently reverting commit %s."),
+                        find_unique_abbrev(state->revert_head_sha1, DEFAULT_ABBREV));
        if (advice_status_hints) {
                if (has_unmerged(s))
                        status_printf_ln(s, color,
@@ -1104,6 +1103,7 @@ void wt_status_get_state(struct wt_status_state *state,
                         int get_detached_from)
 {
        struct stat st;
+       unsigned char sha1[20];
 
        if (!stat(git_path("MERGE_HEAD"), &st)) {
                state->merge_in_progress = 1;
@@ -1131,8 +1131,10 @@ void wt_status_get_state(struct wt_status_state *state,
                state->bisect_in_progress = 1;
                state->branch = read_and_strip_branch("BISECT_START");
        }
-       if (!stat(git_path("REVERT_HEAD"), &st)) {
+       if (!stat(git_path("REVERT_HEAD"), &st) &&
+           !get_sha1("REVERT_HEAD", sha1)) {
                state->revert_in_progress = 1;
+               hashcpy(state->revert_head_sha1, sha1);
        }
 
        if (get_detached_from)
@@ -1221,14 +1223,10 @@ void wt_status_print(struct wt_status *s)
                if (advice_status_u_option && 2000 < s->untracked_in_ms) {
                        status_printf_ln(s, GIT_COLOR_NORMAL, "");
                        status_printf_ln(s, GIT_COLOR_NORMAL,
-                                _("It took %.2f seconds to enumerate untracked files."
-                                  "  'status -uno'"),
-                                s->untracked_in_ms / 1000.0);
-                       status_printf_ln(s, GIT_COLOR_NORMAL,
-                                _("may speed it up, but you have to be careful not"
-                                  " to forget to add"));
-                       status_printf_ln(s, GIT_COLOR_NORMAL,
-                                _("new files yourself (see 'git help status')."));
+                                        _("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
+                                          "may speed it up, but you have to be careful not to forget to add\n"
+                                          "new files yourself (see 'git help status')."),
+                                        s->untracked_in_ms / 1000.0);
                }
        } else if (s->commitable)
                status_printf_ln(s, GIT_COLOR_NORMAL, _("Untracked files not listed%s"),