Skip to content

Commit 01e9ca4

Browse files
ttaylorrgitster
authored andcommitted
reachable.c: extract obj_is_recent()
When enumerating objects in order to add recent ones (i.e. those whose mtime is strictly newer than the cutoff) as tips of a reachability traversal, `add_recent_object()` discards objects which do not meet the recency criteria. The subsequent commit will make checking whether or not an object is recent also consult the list of hooks in `pack.recentHook`. Isolate this check in its own function to keep the additional complexity outside of `add_recent_object()`. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 69c7866 commit 01e9ca4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

reachable.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ struct recent_data {
6969
int ignore_in_core_kept_packs;
7070
};
7171

72+
static int obj_is_recent(const struct object_id *oid, timestamp_t mtime,
73+
struct recent_data *data)
74+
{
75+
return mtime > data->timestamp;
76+
}
77+
7278
static void add_recent_object(const struct object_id *oid,
7379
struct packed_git *pack,
7480
off_t offset,
@@ -78,7 +84,7 @@ static void add_recent_object(const struct object_id *oid,
7884
struct object *obj;
7985
enum object_type type;
8086

81-
if (mtime <= data->timestamp)
87+
if (!obj_is_recent(oid, mtime, data))
8288
return;
8389

8490
/*

0 commit comments

Comments
 (0)