Skip to content

Commit

Permalink
gvfs-helper-client: properly update loose cache with fetched OID
Browse files Browse the repository at this point in the history
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 <jeffhost@microsoft.com>
  • Loading branch information
jeffhostetler authored and dscho committed Sep 16, 2022
1 parent 4c752d2 commit 8ddce84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gvfs-helper-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ static void gh_client__update_loose_cache(const char *line)
if (!skip_prefix(line, "loose ", &v1_oid))
BUG("update_loose_cache: invalid line '%s'", line);

if (get_oid_hex(v1_oid, &oid))
BUG("update_loose_cache: invalid line '%s'", line);

odb_loose_cache_add_new_oid(gh_client__chosen_odb, &oid);
}

Expand Down

0 comments on commit 8ddce84

Please sign in to comment.