Thread (6 messages) flat view 6 messages, 5 authors, 2017-12-25
STALE3194d

[PATCH] setup.c: move statement under condition

From: Vadim Petrov <hidden>
Date: 2017-12-23 20:12:22
Subsystem: the rest · Maintainer: Linus Torvalds

I suppose that if the condition is fulfilled then the previously
obtained value will not be necessary.

Signed-off-by: Vadim Petrov <redacted>
---
 setup.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/setup.c b/setup.c
index 8cc34186c..1ce0189fa 100644
--- a/setup.c
+++ b/setup.c
@@ -35,7 +35,6 @@ static int abspath_part_inside_repo(char *path)
 		return -1;
 	wtlen = strlen(work_tree);
 	len = strlen(path);
-	off = offset_1st_component(path);
 
 	/* check if work tree is already the prefix */
 	if (wtlen <= len && !strncmp(path, work_tree, wtlen)) {
@@ -49,6 +48,8 @@ static int abspath_part_inside_repo(char *path)
 		}
 		/* work tree might match beginning of a symlink to work tree */
 		off = wtlen;
+	} else {
+		off = offset_1st_component(path);
 	}
 	path0 = path;
 	path += off;
-- 
2.15.1.433.g936d1b989
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help