Commit 45c4697c48e50951a383f93d63ad0c192915df8c

Vicent Martí 2012-09-13T09:07:06

Merge pull request #928 from barrbrain/odb-pack-stat-less odb_pack: try lookup before refreshing packs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/odb_pack.c b/src/odb_pack.c
index 6e3d3ee..d33d064 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -268,13 +268,13 @@ static int pack_entry_find(struct git_pack_entry *e, struct pack_backend *backen
 	int error;
 	unsigned int i;
 
-	if ((error = packfile_refresh_all(backend)) < 0)
-		return error;
-
 	if (backend->last_found &&
 		git_pack_entry_find(e, backend->last_found, oid, GIT_OID_HEXSZ) == 0)
 		return 0;
 
+	if ((error = packfile_refresh_all(backend)) < 0)
+		return error;
+
 	for (i = 0; i < backend->packs.length; ++i) {
 		struct git_pack_file *p;