Thread (126 messages) flat view 126 messages, 3 authors, 2017-01-09

Re: [PATCH 16/17] pathspec: small readability changes

From: Duy Nguyen <hidden>
Date: 2016-12-08 09:24:28

On Thu, Dec 8, 2016 at 6:27 AM, Brandon Williams [off-list ref] wrote:
quoted
On Wed, Dec 7, 2016 at 4:51 AM, Brandon Williams [off-list ref] wrote:
quoted
@@ -362,8 +368,6 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
        } else {
                item->original = xstrdup(elt);
        }
-       item->len = strlen(item->match);
-       item->prefix = prefixlen;

        if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP)
            strip_submodule_slash_cheap(item);
@@ -371,13 +375,14 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
        if (flags & PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE)
            strip_submodule_slash_expensive(item);

-       if (magic & PATHSPEC_LITERAL)
+       if (magic & PATHSPEC_LITERAL) {
                item->nowildcard_len = item->len;
-       else {
+       } else {
                item->nowildcard_len = simple_length(item->match);
                if (item->nowildcard_len < prefixlen)
                        item->nowildcard_len = prefixlen;
        }
+
        item->flags = 0;
You probably can move this line up with the others too.
I didn't move the item->flags assignment up since the code immediately
following this assignment deal with setting item->flags.  I made more
sense to keep them grouped.
It's probably why I put it there in the beginning :) Yes let's leave
it where it is then.
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help