Thread (34 messages) flat view 34 messages, 3 authors, 2018-08-15

Re: [PATCH 07/24] ls-files: correct index argument to get_convert_attr_ascii()

From: Stefan Beller <hidden>
Date: 2018-08-15 18:56:57

On Mon, Aug 13, 2018 at 9:15 AM Nguyễn Thái Ngọc Duy [off-list ref] wrote:
quoted hunk ↗ jump to hunk
write_eolinfo() does take an istate as function argument and it should
be used instead of the_index.

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 builtin/ls-files.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 7233b92794..7f9919a362 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -63,7 +63,7 @@ static void write_eolinfo(const struct index_state *istate,
                struct stat st;
                const char *i_txt = "";
                const char *w_txt = "";
-               const char *a_txt = get_convert_attr_ascii(&the_index, path);
+               const char *a_txt = get_convert_attr_ascii(istate, path);
Going by the commit message this patch should end here?
-static void show_dir_entry(const char *tag, struct dir_entry *ent)
+static void show_dir_entry(const struct index_state *istate,
+                          const char *tag, struct dir_entry *ent)
[...]
-       if (!dir_path_match(&the_index, ent, &pathspec, len, ps_matched))
+       if (!dir_path_match(istate, ent, &pathspec, len, ps_matched))
[...]
-       write_eolinfo(NULL, NULL, ent->name);
+       write_eolinfo(istate, NULL, ent->name);
but here we need to pass through the istate, which is why we adjust the
dir_path_match while we're here
-               show_dir_entry(tag_other, ent);
+               show_dir_entry(istate, tag_other, ent);
[...]
-                       show_dir_entry(tag_killed, dir->entries[i]);
+                       show_dir_entry(istate, tag_killed, dir->entries[i]);
and having to adjust more callers here
quoted hunk ↗ jump to hunk
@@ -228,7 +229,7 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
-       } else if (match_pathspec(&the_index, &pathspec, fullname, strlen(fullname),
+       } else if (match_pathspec(repo->index, &pathspec, fullname, strlen(fullname),
quoted hunk ↗ jump to hunk
@@ -264,7 +265,7 @@ static void show_ru_info(const struct index_state *istate)
-               if (!match_pathspec(&the_index, &pathspec, path, len,
+               if (!match_pathspec(istate, &pathspec, path, len,
These seem more or less unrelated to the commit message
or the code changes above. Maybe mention these as a
"while at it" or separate them out in their own commit?

thanks,
Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help