From: Michael Haggerty Date: Mon, 6 Jan 2014 13:45:20 +0000 (+0100) Subject: safe_create_leading_directories(): reduce scope of local variable X-Git-Tag: v1.9-rc1~10^2~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f05023324c74bd12e66ac1dd04bbe2692c31dbfb safe_create_leading_directories(): reduce scope of local variable This makes it more obvious that values of "st" don't persist across loop iterations. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- diff --git a/sha1_file.c b/sha1_file.c index 56b51b03e4..e52a0032e5 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -108,9 +108,10 @@ int mkdir_in_gitdir(const char *path) int safe_create_leading_directories(char *path) { char *pos = path + offset_1st_component(path); - struct stat st; while (pos) { + struct stat st; + pos = strchr(pos, '/'); if (!pos) break;