Commit 70a0c8ec6e6b62f44cf81a937107e64429ee5572

Stefan Sperling 2019-02-20T10:35:33

preserve permissions on merged files

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/worktree.c b/lib/worktree.c
index 22ee00a..f562feb 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -793,6 +793,11 @@ merge_blob(struct got_worktree *worktree, struct got_fileindex *fileindex,
 			goto done;
 	}
 
+	if (chmod(merged_path, st_mode) != 0) {
+		err = got_error_from_errno();
+		goto done;
+	}
+
 	if (rename(merged_path, ondisk_path) != 0) {
 		err = got_error_from_errno();
 		unlink(merged_path);