diff options
Diffstat (limited to 'src/refdb_fs.c')
-rw-r--r-- | src/refdb_fs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 3ac7e8347..d8447eea6 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -333,14 +333,17 @@ static int refdb_fs_backend__exists( assert(backend); - if ((error = packed_reload(backend)) < 0 || - (error = git_buf_joinpath(&ref_path, backend->gitpath, ref_name)) < 0) + if ((error = git_buf_joinpath(&ref_path, backend->gitpath, ref_name)) < 0) return error; + *exists = git_path_isfile(ref_path.ptr); + git_buf_dispose(&ref_path); - *exists = git_path_isfile(ref_path.ptr) || - (git_sortedcache_lookup(backend->refcache, ref_name) != NULL); + if (!*exists) { + if ((error = packed_reload(backend)) < 0) + return error; + *exists = git_sortedcache_lookup(backend->refcache, ref_name) != NULL; + } - git_buf_dispose(&ref_path); return 0; } |