shithub: clone

Download patch

ref: fa1d72ac469051740db03ba97377bdd4465cb480
parent: 9a638c7b37a153e7ca727f7f26c4ddb18c8710d5
author: Noam Preil <noam@pixelhero.dev>
date: Fri Nov 24 13:11:48 EST 2023

transfer existing directories

--- a/clone.c
+++ b/clone.c
@@ -220,11 +220,19 @@
 mkdir(char *src, char *dst, Dir *sd, Dir **dd)
 {
 	int fd;
-	Dir d;
+	Dir d, *dds;
 	if(verbose)
 		print("%s\n", dst);
 	if(dummy)
 		return 1;
+	dds = dirstat(dst);
+	if(dds != nil){
+		if(dd)
+			*dd = dds;
+		else
+			free(dds);
+		return 1;
+	}
 	
 	if(!(sd->mode & 0400)){
 		error("can't clone directory: '%s' permission denied", src);