diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-11-03 17:18:00 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-11-12 09:35:51 -0500 |
commit | b46c7ee5e270cc29e2fc0420a55e347a3242b3b5 (patch) | |
tree | edc402d7b2ccebc9f719ffc048382f55aaf46967 /src/refdb_fs.c | |
parent | ec50b23acc5a9f00f597fa877ad09cad56cb1204 (diff) | |
download | libgit2-b46c7ee5e270cc29e2fc0420a55e347a3242b3b5.tar.gz |
refs: complain when a directory exists at ref
When a (non-empty) directory exists at the reference target
location, complain with a more actionable error message.
Diffstat (limited to 'src/refdb_fs.c')
-rw-r--r-- | src/refdb_fs.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 6d8c76236..c550ee92a 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -733,8 +733,11 @@ static int loose_lock(git_filebuf *file, refdb_fs_backend *backend, const char * error = git_filebuf_open(file, ref_path.ptr, GIT_FILEBUF_FORCE, GIT_REFS_FILE_MODE); + if (error == GIT_EDIRECTORY) + giterr_set(GITERR_REFERENCE, "cannot lock ref '%s', there are refs beneath that folder", name); + git_buf_free(&ref_path); - return error; + return error; } static int loose_commit(git_filebuf *file, const git_reference *ref) |