Commit 54738368ec469dd9706c5c8f97d24affde9edae8

Carlos Martín Nieto 2015-05-15T12:18:05

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 {