git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] setup.c: move statement under condition
@ 2017-12-23 20:02 Vadim Petrov
  2017-12-23 22:48 ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Vadim Petrov @ 2017-12-23 20:02 UTC (permalink / raw)
  To: git@vger.kernel.org

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-27 18:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-23 20:02 [PATCH] setup.c: move statement under condition Vadim Petrov
2017-12-23 22:48 ` Johannes Schindelin
2017-12-24  8:15   ` Vadim Petrov
2017-12-24 17:11     ` Kevin Daudt
2017-12-24 19:35       ` Ævar Arnfjörð Bjarmason
2017-12-25 17:52         ` Martin Werner
2017-12-27 18:57   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).