Thread (21 messages) flat view 21 messages, 2 authors, 2016-06-15

Re: [PATCH v15 02/16] path.c: refactor relative_path(), not only strip prefix

From: Jiang Xin <hidden>
Date: 2016-06-15 22:57:56

2013/6/27 Junio C Hamano [off-list ref]:
quoted
+             } else {
+                     i++;
+                     j++;
+             }
+     }
+
+     if (
+         /* "prefix" seems like prefix of "in" */
+         i >= prefix_len &&
So shouldn't this be "i == prefix_len"?
quoted
+         /*
+          * but "/foo" is not a prefix of "/foobar"
+          * (i.e. prefix not end with '/')
+          */
+         prefix_off < prefix_len) {
+             if (j >= in_len) {
Again, "j == in_len", isn't it?  Or can i and j overrun in_len and
prefix_len?
Yes, better write as ==. But both will pass the test cases.
Since this commit has been merged to next, so let it be?


-- 
Jiang Xin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help