git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] setup.c: move statement under condition

From
VPVadim Petrov <tridronet@yandex.ru>
Date
Dec 23, 2017, 20:02 UTC
Message-ID
<3853941514059379@web42g.yandex.ru>

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

Signed-off-by: Vadim Petrov <tridronet@protonmail.com>
---
 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
Next: Johannes Schindelin
Message 1 of 7 in “setup.c: move statement under condition”
  1. setup.c: move statement under conditionVadim Petrov, Dec 23, 2017
  2. Johannes SchindelinDec 23, 2017
  3. Vadim PetrovDec 24, 2017
  4. Kevin DaudtDec 24, 2017
  5. Ævar Arnfjörð BjarmasonDec 24, 2017
  6. Martin WernerDec 25, 2017
  7. Junio C HamanoDec 27, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.