summaryrefslogtreecommitdiff
path: root/src/odb_loose.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-05-05 16:04:14 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-05-05 16:34:18 +0200
commitee311907ee0299ff2c1d7fc37699dc3e4da20c52 (patch)
treecd26f69937032be089e836f9c35e55ed7df7feea /src/odb_loose.c
parentd2c16e9ac4921e94eb5db972e6b8452d71a623fc (diff)
downloadlibgit2-ee311907ee0299ff2c1d7fc37699dc3e4da20c52.tar.gz
odb: ignore files in the objects dircmn/file-in-objects-dir
We assume that everything under GIT_DIR/objects/ is a directory. This is not necessarily the case if some process left a stray file in there. Check beforehand if we do have a directory and ignore the entry otherwise.
Diffstat (limited to 'src/odb_loose.c')
-rw-r--r--src/odb_loose.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 7b46a6652..b2e8bed4d 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -755,6 +755,10 @@ static int foreach_cb(void *_state, git_buf *path)
{
struct foreach_state *state = (struct foreach_state *) _state;
+ /* non-dir is some stray file, ignore it */
+ if (!git_path_isdir(git_buf_cstr(path)))
+ return 0;
+
return git_path_direach(path, 0, foreach_object_dir_cb, state);
}