summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2014-01-06 14:45:20 +0100
committerJunio C Hamano <gitster@pobox.com>2014-01-06 09:34:19 -0800
commitf05023324c74bd12e66ac1dd04bbe2692c31dbfb (patch)
tree2a9ad008be4dffb51f91a15526fcafd1cb27677c /sha1_file.c
parent53a3972171723d5d67178c9eba03112931a86cae (diff)
downloadgit-f05023324c74bd12e66ac1dd04bbe2692c31dbfb.tar.gz
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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c3
1 files changed, 2 insertions, 1 deletions
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;