fileops: set an error message if we fail to link a file Now that `git_path_direach` lets us specify an error message to report, set an appropriate error message while linking.
diff --git a/src/fileops.c b/src/fileops.c
index 0587c44..566aed1 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -861,7 +861,8 @@ static int _cp_r_callback(void *ref, git_buf *from)
/* make symlink or regular file */
if (info->flags & GIT_CPDIR_LINK_FILES) {
- error = p_link(from->ptr, info->to.ptr);
+ if ((error = p_link(from->ptr, info->to.ptr)) < 0)
+ giterr_set(GITERR_OS, "failed to link '%s'", from->ptr);
} else if (S_ISLNK(from_st.st_mode)) {
error = cp_link(from->ptr, info->to.ptr, (size_t)from_st.st_size);
} else {