Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 builtin/commit.c |  6 +++---
 wt-status.c      | 17 +++++++----------
 wt-status.h      |  2 +-
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/builtin/commit.c b/builtin/commit.c
index 8410617..b706ebb 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1207,10 +1207,10 @@ int cmd_status(int argc, const char **argv, const char 
*prefix)
        if (show_ignored_in_status)
                s.show_ignored_files = 1;
        if (*argv)
-               s.pathspec = get_pathspec(prefix, argv);
+               parse_pathspec(&s.pathspec, PATHSPEC_FROMTOP, 0, prefix, argv);
 
-       read_cache_preload(s.pathspec);
-       refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, s.pathspec, 
NULL, NULL);
+       read_cache_preload(s.pathspec.raw);
+       refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, 
s.pathspec.raw, NULL, NULL);
 
        fd = hold_locked_index(&index_lock, 0);
        if (0 <= fd)
diff --git a/wt-status.c b/wt-status.c
index 2a9658b..13e6aba 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -434,7 +434,7 @@ static void wt_status_collect_changes_worktree(struct 
wt_status *s)
        }
        rev.diffopt.format_callback = wt_status_collect_changed_cb;
        rev.diffopt.format_callback_data = s;
-       init_pathspec(&rev.prune_data, s->pathspec);
+       rev.prune_data = s->pathspec;
        run_diff_files(&rev, 0);
 }
 
@@ -459,22 +459,20 @@ static void wt_status_collect_changes_index(struct 
wt_status *s)
        rev.diffopt.detect_rename = 1;
        rev.diffopt.rename_limit = 200;
        rev.diffopt.break_opt = 0;
-       init_pathspec(&rev.prune_data, s->pathspec);
+       rev.prune_data = s->pathspec;
        run_diff_index(&rev, 1);
 }
 
 static void wt_status_collect_changes_initial(struct wt_status *s)
 {
-       struct pathspec pathspec;
        int i;
 
-       init_pathspec(&pathspec, s->pathspec);
        for (i = 0; i < active_nr; i++) {
                struct string_list_item *it;
                struct wt_status_change_data *d;
                struct cache_entry *ce = active_cache[i];
 
-               if (!ce_path_match(ce, &pathspec))
+               if (!ce_path_match(ce, &s->pathspec))
                        continue;
                it = string_list_insert(&s->change, ce->name);
                d = it->util;
@@ -489,7 +487,6 @@ static void wt_status_collect_changes_initial(struct 
wt_status *s)
                else
                        d->index_status = DIFF_STATUS_ADDED;
        }
-       free_pathspec(&pathspec);
 }
 
 static void wt_status_collect_untracked(struct wt_status *s)
@@ -505,11 +502,11 @@ static void wt_status_collect_untracked(struct wt_status 
*s)
                        DIR_SHOW_OTHER_DIRECTORIES | DIR_HIDE_EMPTY_DIRECTORIES;
        setup_standard_excludes(&dir);
 
-       fill_directory(&dir, s->pathspec);
+       fill_directory(&dir, s->pathspec.raw);
        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))
+                   match_pathspec_depth(&s->pathspec, ent->name, ent->len, 0, 
NULL))
                        string_list_insert(&s->untracked, ent->name);
                free(ent);
        }
@@ -517,11 +514,11 @@ static void wt_status_collect_untracked(struct wt_status 
*s)
        if (s->show_ignored_files) {
                dir.nr = 0;
                dir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;
-               fill_directory(&dir, s->pathspec);
+               fill_directory(&dir, s->pathspec.raw);
                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))
+                           match_pathspec_depth(&s->pathspec, ent->name, 
ent->len, 0, NULL))
                                string_list_insert(&s->ignored, ent->name);
                        free(ent);
                }
diff --git a/wt-status.h b/wt-status.h
index 236b41f..dd8df41 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -44,7 +44,7 @@ struct wt_status {
        int is_initial;
        char *branch;
        const char *reference;
-       const char **pathspec;
+       struct pathspec pathspec;
        int verbose;
        int amend;
        enum commit_whence whence;
-- 
1.8.0.rc2.23.g1fb49df

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to