Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be563b7

Browse filesBrowse files
jeffhostetlerdscho
authored andcommitted
sha1-file: add function to update existing loose object cache
Create a function to add a new object to the loose object cache after the existing odb/xx/ directory was scanned. This will be used in a later commit to keep the loose object cache fresh after dynamically fetching an individual object and without requiring the odb/xx/ directory to be rescanned. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
1 parent b5cdcff commit be563b7
Copy full SHA for be563b7

File tree

Expand file treeCollapse file tree

2 files changed

+15
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-0
lines changed
Open diff view settings
Collapse file

‎object-file.c‎

Copy file name to clipboardExpand all lines: object-file.c
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,13 @@ struct oidtree *odb_loose_cache(struct odb_source *source,
18461846
return source->loose_objects_cache;
18471847
}
18481848

1849+
void odb_loose_cache_add_new_oid(struct odb_source *source,
1850+
const struct object_id *oid)
1851+
{
1852+
struct oidtree *cache = odb_loose_cache(source, oid);
1853+
append_loose_object(oid, NULL, cache);
1854+
}
1855+
18491856
void odb_clear_loose_cache(struct odb_source *source)
18501857
{
18511858
oidtree_clear(source->loose_objects_cache);
Collapse file

‎object-file.h‎

Copy file name to clipboardExpand all lines: object-file.h
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ struct odb_source;
3333
struct oidtree *odb_loose_cache(struct odb_source *source,
3434
const struct object_id *oid);
3535

36+
/*
37+
* Add a new object to the loose object cache (possibly after the
38+
* cache was populated). This might be used after dynamically
39+
* fetching a missing object.
40+
*/
41+
void odb_loose_cache_add_new_oid(struct odb_source *source,
42+
const struct object_id *oid);
43+
3644
/* Empty the loose object cache for the specified object directory. */
3745
void odb_clear_loose_cache(struct odb_source *source);
3846

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.