Commit 27e3c58392a53a66a4b914d570a0af87a3a58c68

nulltoken 2012-10-03T15:12:42

reflog: create reflog and its directory structure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/reflog.c b/src/reflog.c
index 3c780cd..17cd6d9 100644
--- a/src/reflog.c
+++ b/src/reflog.c
@@ -188,7 +188,10 @@ static int retrieve_reflog_path(git_buf *path, git_reference *ref)
 
 static int create_new_reflog_file(const char *filepath)
 {
-	int fd;
+	int fd, error;
+
+	if ((error = git_futils_mkpath2file(filepath, GIT_REFLOG_DIR_MODE)) < 0)
+		return error;
 
 	if ((fd = p_open(filepath,
 			O_WRONLY | O_CREAT | O_TRUNC,