vendor/libgit2/src/fileops.c in rugged-0.25.1.1 vs vendor/libgit2/src/fileops.c in rugged-0.26.0b1
- old
+ new
@@ -35,17 +35,17 @@
if (git_buf_oom(path_out))
return -1;
if ((fd = p_mkstemp(path_out->ptr)) < 0) {
giterr_set(GITERR_OS,
- "Failed to create temporary file '%s'", path_out->ptr);
+ "failed to create temporary file '%s'", path_out->ptr);
return -1;
}
if (p_chmod(path_out->ptr, (mode & ~mask))) {
giterr_set(GITERR_OS,
- "Failed to set permissions on file '%s'", path_out->ptr);
+ "failed to set permissions on file '%s'", path_out->ptr);
return -1;
}
return fd;
}
@@ -57,11 +57,11 @@
if (git_futils_mkpath2file(path, dirmode) < 0)
return -1;
fd = p_creat(path, mode);
if (fd < 0) {
- giterr_set(GITERR_OS, "Failed to create file '%s'", path);
+ giterr_set(GITERR_OS, "failed to create file '%s'", path);
return -1;
}
return fd;
}
@@ -71,11 +71,11 @@
int fd = p_open(path, O_WRONLY | O_CREAT | O_TRUNC |
O_EXCL | O_BINARY | O_CLOEXEC, mode);
if (fd < 0) {
int error = errno;
- giterr_set(GITERR_OS, "Failed to create locked file '%s'", path);
+ giterr_set(GITERR_OS, "failed to create locked file '%s'", path);
switch (error) {
case EEXIST:
return GIT_ELOCKED;
case ENOENT:
return GIT_ENOTFOUND;
@@ -106,11 +106,11 @@
git_off_t git_futils_filesize(git_file fd)
{
struct stat sb;
if (p_fstat(fd, &sb)) {
- giterr_set(GITERR_OS, "Failed to stat file descriptor");
+ giterr_set(GITERR_OS, "failed to stat file descriptor");
return -1;
}
return sb.st_size;
}
@@ -135,11 +135,11 @@
size_t alloc_len;
git_buf_clear(buf);
if (!git__is_ssizet(len)) {
- giterr_set(GITERR_INVALID, "Read too large.");
+ giterr_set(GITERR_INVALID, "read too large");
return -1;
}
GITERR_CHECK_ALLOC_ADD(&alloc_len, len, 1);
if (git_buf_grow(buf, alloc_len) < 0)
@@ -147,11 +147,11 @@
/* p_read loops internally to read len bytes */
read_size = p_read(fd, buf->ptr, len);
if (read_size != (ssize_t)len) {
- giterr_set(GITERR_OS, "Failed to read descriptor");
+ giterr_set(GITERR_OS, "failed to read descriptor");
git_buf_free(buf);
return -1;
}
buf->ptr[read_size] = '\0';
@@ -182,11 +182,11 @@
giterr_set(GITERR_INVALID, "requested file is a directory");
return GIT_ENOTFOUND;
}
if (!git__is_sizet(st.st_size+1)) {
- giterr_set(GITERR_OS, "Invalid regular file stat for '%s'", path);
+ giterr_set(GITERR_OS, "invalid regular file stat for '%s'", path);
return -1;
}
if ((fd = git_futils_open_ro(path)) < 0)
return fd;
@@ -243,33 +243,33 @@
flags = O_CREAT | O_TRUNC | O_WRONLY;
if (!mode)
mode = GIT_FILEMODE_BLOB;
if ((fd = p_open(path, flags, mode)) < 0) {
- giterr_set(GITERR_OS, "Could not open '%s' for writing", path);
+ giterr_set(GITERR_OS, "could not open '%s' for writing", path);
return fd;
}
if ((error = p_write(fd, git_buf_cstr(buf), git_buf_len(buf))) < 0) {
- giterr_set(GITERR_OS, "Could not write to '%s'", path);
+ giterr_set(GITERR_OS, "could not write to '%s'", path);
(void)p_close(fd);
return error;
}
if ((error = p_close(fd)) < 0)
- giterr_set(GITERR_OS, "Error while closing '%s'", path);
+ giterr_set(GITERR_OS, "error while closing '%s'", path);
return error;
}
int git_futils_mv_withpath(const char *from, const char *to, const mode_t dirmode)
{
if (git_futils_mkpath2file(to, dirmode) < 0)
return -1;
if (p_rename(from, to) < 0) {
- giterr_set(GITERR_OS, "Failed to rename '%s' to '%s'", from, to);
+ giterr_set(GITERR_OS, "failed to rename '%s' to '%s'", from, to);
return -1;
}
return 0;
}
@@ -288,11 +288,11 @@
if (fd < 0)
return fd;
len = git_futils_filesize(fd);
if (!git__is_sizet(len)) {
- giterr_set(GITERR_OS, "File `%s` too large to mmap", path);
+ giterr_set(GITERR_OS, "file `%s` too large to mmap", path);
return -1;
}
result = git_futils_mmap_ro(out, fd, 0, (size_t)len);
p_close(fd);
@@ -312,43 +312,43 @@
struct git_futils_mkdir_options *opts)
{
/* with exclusive create, existing dir is an error */
if ((flags & GIT_MKDIR_EXCL) != 0) {
giterr_set(GITERR_FILESYSTEM,
- "Failed to make directory '%s': directory exists", path);
+ "failed to make directory '%s': directory exists", path);
return GIT_EEXISTS;
}
if ((S_ISREG(st->st_mode) && (flags & GIT_MKDIR_REMOVE_FILES)) ||
(S_ISLNK(st->st_mode) && (flags & GIT_MKDIR_REMOVE_SYMLINKS))) {
if (p_unlink(path) < 0) {
- giterr_set(GITERR_OS, "Failed to remove %s '%s'",
+ giterr_set(GITERR_OS, "failed to remove %s '%s'",
S_ISLNK(st->st_mode) ? "symlink" : "file", path);
return GIT_EEXISTS;
}
opts->perfdata.mkdir_calls++;
if (p_mkdir(path, mode) < 0) {
- giterr_set(GITERR_OS, "Failed to make directory '%s'", path);
+ giterr_set(GITERR_OS, "failed to make directory '%s'", path);
return GIT_EEXISTS;
}
}
else if (S_ISLNK(st->st_mode)) {
/* Re-stat the target, make sure it's a directory */
opts->perfdata.stat_calls++;
if (p_stat(path, st) < 0) {
- giterr_set(GITERR_OS, "Failed to make directory '%s'", path);
+ giterr_set(GITERR_OS, "failed to make directory '%s'", path);
return GIT_EEXISTS;
}
}
else if (!S_ISDIR(st->st_mode)) {
giterr_set(GITERR_FILESYSTEM,
- "Failed to make directory '%s': directory exists", path);
+ "failed to make directory '%s': directory exists", path);
return GIT_EEXISTS;
}
return 0;
}
@@ -567,22 +567,22 @@
opts->perfdata.stat_calls++;
retry_lstat:
if (p_lstat(make_path.ptr, &st) < 0) {
if (mkdir_attempted || errno != ENOENT) {
- giterr_set(GITERR_OS, "Cannot access component in path '%s'", make_path.ptr);
+ giterr_set(GITERR_OS, "cannot access component in path '%s'", make_path.ptr);
error = -1;
goto done;
}
giterr_clear();
opts->perfdata.mkdir_calls++;
mkdir_attempted = true;
if (p_mkdir(make_path.ptr, mode) < 0) {
if (errno == EEXIST)
goto retry_lstat;
- giterr_set(GITERR_OS, "Failed to make directory '%s'", make_path.ptr);
+ giterr_set(GITERR_OS, "failed to make directory '%s'", make_path.ptr);
error = -1;
goto done;
}
} else {
if ((error = mkdir_validate_dir(
@@ -619,11 +619,11 @@
if ((flags & GIT_MKDIR_VERIFY_DIR) != 0 &&
lastch != '\0') {
opts->perfdata.stat_calls++;
if (p_stat(make_path.ptr, &st) < 0 || !S_ISDIR(st.st_mode)) {
- giterr_set(GITERR_OS, "Path is not a directory '%s'",
+ giterr_set(GITERR_OS, "path is not a directory '%s'",
make_path.ptr);
error = GIT_ENOTFOUND;
}
}
@@ -642,14 +642,14 @@
#define FUTILS_MAX_DEPTH 100
static int futils__error_cannot_rmdir(const char *path, const char *filemsg)
{
if (filemsg)
- giterr_set(GITERR_OS, "Could not remove directory. File '%s' %s",
+ giterr_set(GITERR_OS, "could not remove directory '%s': %s",
path, filemsg);
else
- giterr_set(GITERR_OS, "Could not remove directory '%s'", path);
+ giterr_set(GITERR_OS, "could not remove directory '%s'", path);
return -1;
}
static int futils__rm_first_parent(git_buf *path, const char *ceiling)
@@ -813,11 +813,11 @@
* internally and will return 0 when it has completed writing.
*/
error = p_write(ofd, buffer, len);
if (len < 0) {
- giterr_set(GITERR_OS, "Read error while copying file");
+ giterr_set(GITERR_OS, "read error while copying file");
error = (int)len;
}
if (error < 0)
giterr_set(GITERR_OS, "write error while copying file");
@@ -869,18 +869,18 @@
link_data = git__malloc(alloc_size);
GITERR_CHECK_ALLOC(link_data);
read_len = p_readlink(from, link_data, link_size);
if (read_len != (ssize_t)link_size) {
- giterr_set(GITERR_OS, "Failed to read symlink data for '%s'", from);
+ giterr_set(GITERR_OS, "failed to read symlink data for '%s'", from);
error = -1;
}
else {
link_data[read_len] = '\0';
if (p_symlink(link_data, to) < 0) {
- giterr_set(GITERR_OS, "Could not symlink '%s' as '%s'",
+ giterr_set(GITERR_OS, "could not symlink '%s' as '%s'",
link_data, to);
error = -1;
}
}
@@ -972,10 +972,10 @@
if (exists) {
if ((info->flags & GIT_CPDIR_OVERWRITE) == 0)
return 0;
if (p_unlink(info->to.ptr) < 0) {
- giterr_set(GITERR_OS, "Cannot overwrite existing file '%s'",
+ giterr_set(GITERR_OS, "cannot overwrite existing file '%s'",
info->to.ptr);
return GIT_EEXISTS;
}
}