Skip to content

Commit 3cf451a

Browse files
jeffhostetlermjcheetham
authored andcommitted
gvfs-helper-client: properly update loose cache with fetched OID
Fix parsing of the "loose <odb>" response from `gvfs-helper` and use the actually parsed OID when updating the loose oid cache. Previously, an uninitialized "struct oid" was used to update the cache. This did not cause any corruption, but could cause extra fetches for objects visited multiple times. Signed-off-by: Jeff Hostetler <[email protected]>
1 parent 1096bda commit 3cf451a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gvfs-helper-client.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "pkt-line.h"
1414
#include "quote.h"
1515
#include "packfile.h"
16+
#include "hex.h"
1617

1718
static struct oidset gh_client__oidset_queued = OIDSET_INIT;
1819
static unsigned long gh_client__oidset_count;
@@ -94,6 +95,9 @@ static void gh_client__update_loose_cache(const char *line)
9495
if (!skip_prefix(line, "loose ", &v1_oid))
9596
BUG("update_loose_cache: invalid line '%s'", line);
9697

98+
if (get_oid_hex(v1_oid, &oid))
99+
BUG("update_loose_cache: invalid line '%s'", line);
100+
97101
odb_loose_cache_add_new_oid(gh_client__chosen_odb, &oid);
98102
}
99103

0 commit comments

Comments
 (0)