line |
true |
false |
branch |
46
|
0 |
316 |
if (git_path_exists(file->path_lock) == true) { |
54
|
144 |
172 |
if (flags & GIT_FILEBUF_CREATE_LEADING_DIRS) { |
61
|
0 |
316 |
if (file->fd < 0) |
66
|
3 |
313 |
if ((flags & GIT_FILEBUF_APPEND) && git_path_exists(file->path_original) == true) { |
|
3 |
0 |
if ((flags & GIT_FILEBUF_APPEND) && git_path_exists(file->path_original) == true) { |
73
|
0 |
3 |
if (source < 0) { |
80
|
3 |
3 |
while ((read_bytes = p_read(source, buffer, sizeof(buffer))) > 0) { |
81
|
0 |
3 |
if ((error = p_write(file->fd, buffer, read_bytes)) < 0) |
83
|
0 |
3 |
if (file->compute_digest) |
89
|
0 |
3 |
if (read_bytes < 0) { |
92
|
0 |
3 |
} else if (error < 0) { |
103
|
36 |
653 |
if (file->fd_is_open && file->fd >= 0) |
|
36 |
0 |
if (file->fd_is_open && file->fd >= 0) |
106
|
493 |
196 |
if (file->created_lock && !file->did_rename && file->path_lock && git_path_exists(file->path_lock)) |
|
36 |
457 |
if (file->created_lock && !file->did_rename && file->path_lock && git_path_exists(file->path_lock)) |
|
36 |
0 |
if (file->created_lock && !file->did_rename && file->path_lock && git_path_exists(file->path_lock)) |
|
36 |
0 |
if (file->created_lock && !file->did_rename && file->path_lock && git_path_exists(file->path_lock)) |
109
|
50 |
639 |
if (file->compute_digest) { |
114
|
490 |
199 |
if (file->buffer) |
118
|
177 |
512 |
if (file->z_buf) { |
123
|
473 |
216 |
if (file->path_original) |
125
|
493 |
196 |
if (file->path_lock) |
146
|
401 |
4 |
if (len > 0) { |
147
|
0 |
401 |
if (p_write(file->fd, (void *)source, len) < 0) { |
152
|
151 |
250 |
if (file->compute_digest) |
163
|
0 |
157 |
if (len > 0 || file->flush_mode == Z_FINISH) { |
|
0 |
0 |
if (len > 0 || file->flush_mode == Z_FINISH) { |
173
|
0 |
157 |
if (deflate(zs, file->flush_mode) == Z_STREAM_ERROR) { |
180
|
0 |
157 |
if (p_write(file->fd, file->z_buf, have) < 0) { |
185
|
0 |
157 |
} while (zs->avail_out == 0); |
187
|
0 |
157 |
assert(zs->avail_in == 0); |
189
|
0 |
157 |
if (file->compute_digest) |
205
|
316 |
0 |
if ((error = git_buf_grow(&target, GIT_PATH_MAX + 1)) < 0 || |
|
0 |
316 |
if ((error = git_buf_grow(&target, GIT_PATH_MAX + 1)) < 0 || |
209
|
316 |
0 |
for (i = 0; i < MAX_SYMLINK_DEPTH; i++) { |
211
|
75 |
241 |
if (error < 0 && errno == ENOENT) { |
|
75 |
0 |
if (error < 0 && errno == ENOENT) { |
216
|
0 |
241 |
if (error < 0) { |
222
|
241 |
0 |
if (!S_ISLNK(st.st_mode)) { |
228
|
0 |
0 |
if (ret < 0) { |
234
|
0 |
0 |
if (ret == GIT_PATH_MAX) { |
245
|
0 |
0 |
if (root >= 0) { |
246
|
0 |
0 |
if ((error = git_buf_sets(&curpath, target.ptr)) < 0) |
251
|
0 |
0 |
if ((error = git_path_dirname_r(&dir, curpath.ptr)) < 0) |
257
|
0 |
0 |
if ((error = git_path_apply_relative(&curpath, target.ptr)) < 0) |
284
|
493 |
0 |
assert(file && path && file->buffer == NULL); |
|
493 |
0 |
assert(file && path && file->buffer == NULL); |
|
0 |
493 |
assert(file && path && file->buffer == NULL); |
288
|
3 |
490 |
if (flags & GIT_FILEBUF_DO_NOT_BUFFER) |
291
|
0 |
493 |
if (flags & GIT_FILEBUF_FSYNC) |
300
|
490 |
3 |
if (!file->do_not_buffer) { |
302
|
0 |
490 |
GIT_ERROR_CHECK_ALLOC(file->buffer); |
306
|
152 |
341 |
if (flags & GIT_FILEBUF_HASH_CONTENTS) { |
309
|
0 |
152 |
if (git_hash_ctx_init(&file->digest) < 0) |
316
|
177 |
316 |
if (compression != 0) { |
318
|
0 |
177 |
if (deflateInit(&file->zs, compression) != Z_OK) { |
325
|
0 |
177 |
GIT_ERROR_CHECK_ALLOC(file->z_buf); |
335
|
177 |
316 |
if (flags & GIT_FILEBUF_TEMPORARY) { |
341
|
0 |
177 |
if (file->fd < 0) { |
351
|
0 |
177 |
GIT_ERROR_CHECK_ALLOC(file->path_lock); |
355
|
0 |
316 |
if ((error = resolve_symlink(&resolved_path, path)) < 0) |
363
|
0 |
316 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, path_len, GIT_FILELOCK_EXTLENGTH); |
|
0 |
316 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, path_len, GIT_FILELOCK_EXTLENGTH); |
365
|
0 |
316 |
GIT_ERROR_CHECK_ALLOC(file->path_lock); |
370
|
0 |
316 |
if (git_path_isdir(file->path_original)) { |
377
|
0 |
316 |
if ((error = lock_file(file, flags, mode)) < 0) |
392
|
102 |
0 |
assert(oid && file && file->compute_digest); |
|
102 |
0 |
assert(oid && file && file->compute_digest); |
|
0 |
102 |
assert(oid && file && file->compute_digest); |
396
|
0 |
102 |
if (verify_last_error(file) < 0) |
410
|
0 |
162 |
GIT_ERROR_CHECK_ALLOC(file->path_original); |
418
|
457 |
0 |
assert(file && file->path_original); |
|
0 |
457 |
assert(file && file->path_original); |
423
|
0 |
457 |
if (verify_last_error(file) < 0) |
428
|
0 |
457 |
if (file->do_fsync && p_fsync(file->fd) < 0) { |
|
0 |
0 |
if (file->do_fsync && p_fsync(file->fd) < 0) { |
433
|
0 |
457 |
if (p_close(file->fd) < 0) { |
440
|
0 |
457 |
if (p_rename(file->path_lock, file->path_original) < 0) { |
445
|
0 |
457 |
if (file->do_fsync && git_futils_fsync_parent(file->path_original) < 0) |
|
0 |
0 |
if (file->do_fsync && git_futils_fsync_parent(file->path_original) < 0) |
468
|
0 |
2243 |
ENSURE_BUF_OK(file); |
470
|
3 |
2240 |
if (file->do_not_buffer) |
477
|
2240 |
0 |
if (space_left > len) { |
483
|
0 |
0 |
if (flush_buffer(file) < 0) |
497
|
0 |
206 |
ENSURE_BUF_OK(file); |
499
|
0 |
206 |
if (len > file->buf_size) { |
504
|
0 |
206 |
if (space_left <= len) { |
505
|
0 |
0 |
if (flush_buffer(file) < 0) |
522
|
0 |
147 |
ENSURE_BUF_OK(file); |
531
|
0 |
147 |
if (written < 0) { |
537
|
147 |
0 |
if (len + 1 <= space_left) { |
542
|
0 |
0 |
if (flush_buffer(file) < 0) |
547
|
0 |
0 |
} while (len + 1 <= space_left); |
549
|
0 |
0 |
if (GIT_ADD_SIZET_OVERFLOW(&alloclen, len, 1) || |
|
0 |
0 |
if (GIT_ADD_SIZET_OVERFLOW(&alloclen, len, 1) || |
559
|
0 |
0 |
if (written < 0) { |
576
|
0 |
0 |
if (file->fd_is_open) |
581
|
0 |
0 |
if (res < 0) { |
587
|
0 |
0 |
if (mtime) |
589
|
0 |
0 |
if (size) |