summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-11 17:28:25 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-11 17:28:25 -0800
commit15debaf5da2821e6f97038218b46d9fb3c755631 (patch)
tree7c5792262c8b4bcb729a522b5f0d900de9767dbe /src/fileops.c
parent6a67a812c224878483659c6f25ca21573d1c309b (diff)
downloadlibgit2-15debaf5da2821e6f97038218b46d9fb3c755631.tar.gz
Fix bug in dir_for_path
The last checkin accidentally broke dir_for_path by propogating the dirname return code even when there was no error.
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fileops.c b/src/fileops.c
index 1d991b36d..3412a47e2 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -551,7 +551,8 @@ int git_futils_dir_for_path(git_buf *dir, const char *path, const char *base)
/* call dirname if this is not a directory */
if (error == GIT_SUCCESS && git_futils_isdir(dir->ptr) != GIT_SUCCESS)
- error = git_path_dirname_r(dir, dir->ptr);
+ if (git_path_dirname_r(dir, dir->ptr) < GIT_SUCCESS)
+ error = git_buf_lasterror(dir);
if (error == GIT_SUCCESS)
error = git_path_to_dir(dir);