From 2057bf1eb5aaf0a9fea2beb8083a3052936b34ea Mon Sep 17 00:00:00 2001 From: Galin Simeonov Date: Sun, 26 Sep 2021 19:12:03 +0300 Subject: generates a tree dump for the HEAD of all the branches --- system_part.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'system_part.c') diff --git a/system_part.c b/system_part.c index aaf2301..526f9be 100644 --- a/system_part.c +++ b/system_part.c @@ -83,33 +83,20 @@ FILE* create_file(int branch_dir,const char *filename) die("Could not open the file '%s' for one of the branches\n",filename); return fdopen(fd,"w"); } -int create_files_dir(int branch_dir) +int create_dir(int base_dir,const char *dir_name) { int ret; - - ret=openat(branch_dir,"files",O_DIRECTORY|O_RDONLY); + ret=openat(base_dir,dir_name,O_DIRECTORY|O_RDONLY); if(ret!=-1) return ret; - ret=mkdirat(branch_dir,"files",0770); + mkdirat(base_dir,dir_name,0770); + ret=openat(base_dir,dir_name,O_DIRECTORY|O_RDONLY); if(ret==-1) die("Could not create the 'files' subdirectory of one of the branch dirs\n"); return ret; } -int create_diff_dir(int branch_dir) -{ - int ret; - - ret=openat(branch_dir,"diffs",O_DIRECTORY|O_RDONLY); - if(ret!=-1) - return ret; - mkdirat(branch_dir,"diffs",0770); - ret=openat(branch_dir,"diffs",O_DIRECTORY|O_RDONLY); - if(ret==-1) - die("Could not create the 'diffs' subdirectory of one of the branch dirs\n"); - return ret; -} void die(const char *format, ...) { -- cgit v1.2.3