Commit b90deaa1e76f50309d3cada092bfdc25edefa9a2

Stefan Sperling 2019-07-27T14:31:45

don't fail hard if 'objects/pack' directory does not exist in repo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/repository.c b/lib/repository.c
index 20596a1..04a5cf5 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -653,7 +653,10 @@ got_repo_search_packidx(struct got_packidx **packidx, int *idx,
 
 	packdir = opendir(path_packdir);
 	if (packdir == NULL) {
-		err = got_error_from_errno2("opendir", path_packdir);
+		if (errno == ENOENT)
+			err = got_error_no_obj(id);
+		else
+			err = got_error_from_errno2("opendir", path_packdir);
 		goto done;
 	}