Commit 3714c13a888cfa539d1c6924d6b7bc747c137a42

Carlos Martín Nieto 2016-12-19T17:28:41

Merge pull request #4026 from libgit2/cmn/refdb-fs-errors refdb: bubble up recursive rm when locking a ref

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/refdb_fs.c b/src/refdb_fs.c
index 558d060..8739d5b 100644
--- a/src/refdb_fs.c
+++ b/src/refdb_fs.c
@@ -729,8 +729,8 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char *
 	/* Remove a possibly existing empty directory hierarchy
 	 * which name would collide with the reference name
 	 */
-	if (git_futils_rmdir_r(name, backend->path, GIT_RMDIR_SKIP_NONEMPTY) < 0)
-		return -1;
+	if ((error = git_futils_rmdir_r(name, backend->path, GIT_RMDIR_SKIP_NONEMPTY)) < 0)
+		return error;
 
 	if (git_buf_joinpath(&ref_path, backend->path, name) < 0)
 		return -1;