diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-11-12 19:22:31 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-11-12 19:22:31 +0100 |
| commit | 2c26c8679ffc02b6644e20eba9458121b944beb6 (patch) | |
| tree | 97a86f3892ea849386803df83065208df573d3ce /src/filebuf.c | |
| parent | ecdc04287a9a245b9947aee21a86dc2f09a1bdcf (diff) | |
| parent | 0a700ee368818da526981b09c1c5bbef8c9b5fb8 (diff) | |
| download | libgit2-2c26c8679ffc02b6644e20eba9458121b944beb6.tar.gz | |
Merge pull request #3499 from ethomson/ref_dir_errmsgs
Improve error messages when dirs prevent ref/reflog creation
Diffstat (limited to 'src/filebuf.c')
| -rw-r--r-- | src/filebuf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/filebuf.c b/src/filebuf.c index 2bbc210ba..17efe872e 100644 --- a/src/filebuf.c +++ b/src/filebuf.c @@ -357,6 +357,12 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags, mode_t mode memcpy(file->path_lock, file->path_original, path_len); memcpy(file->path_lock + path_len, GIT_FILELOCK_EXTENSION, GIT_FILELOCK_EXTLENGTH); + if (git_path_isdir(file->path_original)) { + giterr_set(GITERR_FILESYSTEM, "path '%s' is a directory", file->path_original); + error = GIT_EDIRECTORY; + goto cleanup; + } + /* open the file for locking */ if ((error = lock_file(file, flags, mode)) < 0) goto cleanup; |
