refs API: remove OID argument to reflog_expire()
Since the the preceding commit the "oid" parameter to reflog_expire() is always NULL, but it was not cleaned up to reduce the size of the diff. Let's do that subsequent API and documentation cleanup now. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Aug 23, 2021 at 13:36 UTC
cc40b5ce137d0189aa52ab4c3d5ad3957342da5a
7 files changed
+15
-17
builtin/reflog.c
+3
-3
@@ -631,7 +631,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
631
struct collected_reflog *e = collected.e[i];
632
633
set_reflog_expiry_param(&cb.cmd, explicit_expiry, e->reflog);
634
- status |= reflog_expire(e->reflog, NULL, flags,
634
+ status |= reflog_expire(e->reflog, flags,
635
reflog_expiry_prepare,
636
should_expire_reflog_ent,
637
reflog_expiry_cleanup,
@@ -648,7 +648,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
648
continue;
649
}
650
set_reflog_expiry_param(&cb.cmd, explicit_expiry, ref);
651
- status |= reflog_expire(ref, NULL, flags,
651
+ status |= reflog_expire(ref, flags,
652
reflog_expiry_prepare,
653
should_expire_reflog_ent,
654
reflog_expiry_cleanup,
@@ -723,7 +723,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
723
cb.cmd.expire_total = 0;
724
}
725
726
- status |= reflog_expire(ref, NULL, flags,
726
+ status |= reflog_expire(ref, flags,
727
reflog_expiry_prepare,
728
should_expire_reflog_ent,
729
reflog_expiry_cleanup,
refs.c
+4
-4
@@ -2371,19 +2371,19 @@ int delete_reflog(const char *refname)
2371
}
2372
2373
int refs_reflog_expire(struct ref_store *refs,
2374
- const char *refname, const struct object_id *oid,
2374
+ const char *refname,
2375
unsigned int flags,
2376
reflog_expiry_prepare_fn prepare_fn,
2377
reflog_expiry_should_prune_fn should_prune_fn,
2378
reflog_expiry_cleanup_fn cleanup_fn,
2379
void *policy_cb_data)
2380
{
2381
- return refs->be->reflog_expire(refs, refname, oid, flags,
2381
+ return refs->be->reflog_expire(refs, refname, flags,
2382
prepare_fn, should_prune_fn,
2383
cleanup_fn, policy_cb_data);
2384
}
2385
2386
-int reflog_expire(const char *refname, const struct object_id *oid,
2386
+int reflog_expire(const char *refname,
2387
unsigned int flags,
2388
reflog_expiry_prepare_fn prepare_fn,
2389
reflog_expiry_should_prune_fn should_prune_fn,
@@ -2391,7 +2391,7 @@ int reflog_expire(const char *refname, const struct object_id *oid,
2391
void *policy_cb_data)
2392
{
2393
return refs_reflog_expire(get_main_ref_store(the_repository),
2394
- refname, oid, flags,
2394
+ refname, flags,
2395
prepare_fn, should_prune_fn,
2396
cleanup_fn, policy_cb_data);
2397
}
refs.h
+3
-4
@@ -816,20 +816,19 @@ typedef int reflog_expiry_should_prune_fn(struct object_id *ooid,
816
typedef void reflog_expiry_cleanup_fn(void *cb_data);
817
818
/*
819
- * Expire reflog entries for the specified reference. oid is the old
820
- * value of the reference. flags is a combination of the constants in
819
+ * Expire reflog entries for the specified reference.
820
+ * flags is a combination of the constants in
821
* enum expire_reflog_flags. The three function pointers are described
822
* above. On success, return zero.
823
*/
824
int refs_reflog_expire(struct ref_store *refs,
825
const char *refname,
826
- const struct object_id *oid,
826
unsigned int flags,
827
reflog_expiry_prepare_fn prepare_fn,
828
reflog_expiry_should_prune_fn should_prune_fn,
829
reflog_expiry_cleanup_fn cleanup_fn,
830
void *policy_cb_data);
832
-int reflog_expire(const char *refname, const struct object_id *oid,
831
+int reflog_expire(const char *refname,
832
unsigned int flags,
833
reflog_expiry_prepare_fn prepare_fn,
834
reflog_expiry_should_prune_fn should_prune_fn,
refs/debug.c
+2
-2
@@ -391,7 +391,7 @@ static void debug_reflog_expiry_cleanup(void *cb_data)
391
}
392
393
static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
394
- const struct object_id *oid, unsigned int flags,
394
+ unsigned int flags,
395
reflog_expiry_prepare_fn prepare_fn,
396
reflog_expiry_should_prune_fn should_prune_fn,
397
reflog_expiry_cleanup_fn cleanup_fn,
@@ -404,7 +404,7 @@ static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
404
.should_prune = should_prune_fn,
405
.cb_data = policy_cb_data,
406
};
407
- int res = drefs->refs->be->reflog_expire(drefs->refs, refname, oid,
407
+ int res = drefs->refs->be->reflog_expire(drefs->refs, refname,
408
flags, &debug_reflog_expiry_prepare,
409
&debug_reflog_expiry_should_prune_fn,
410
&debug_reflog_expiry_cleanup,
refs/files-backend.c
+1
-2
@@ -3027,7 +3027,7 @@ static int expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
3027
}
3028
3029
static int files_reflog_expire(struct ref_store *ref_store,
3030
- const char *refname, const struct object_id *unused_oid,
3030
+ const char *refname,
3031
unsigned int flags,
3032
reflog_expiry_prepare_fn prepare_fn,
3033
reflog_expiry_should_prune_fn should_prune_fn,
@@ -3106,7 +3106,6 @@ static int files_reflog_expire(struct ref_store *ref_store,
3106
}
3107
}
3108
3109
- assert(!unused_oid);
3109
(*prepare_fn)(refname, oid, cb.policy_cb);
3110
refs_for_each_reflog_ent(ref_store, refname, expire_reflog_ent, &cb);
3111
(*cleanup_fn)(cb.policy_cb);
refs/packed-backend.c
+1
-1
@@ -1635,7 +1635,7 @@ static int packed_delete_reflog(struct ref_store *ref_store,
1635
}
1636
1637
static int packed_reflog_expire(struct ref_store *ref_store,
1638
- const char *refname, const struct object_id *oid,
1638
+ const char *refname,
1639
unsigned int flags,
1640
reflog_expiry_prepare_fn prepare_fn,
1641
reflog_expiry_should_prune_fn should_prune_fn,
refs/refs-internal.h
+1
-1
@@ -593,7 +593,7 @@ typedef int create_reflog_fn(struct ref_store *ref_store, const char *refname,
593
int force_create, struct strbuf *err);
594
typedef int delete_reflog_fn(struct ref_store *ref_store, const char *refname);
595
typedef int reflog_expire_fn(struct ref_store *ref_store,
596
- const char *refname, const struct object_id *oid,
596
+ const char *refname,
597
unsigned int flags,
598
reflog_expiry_prepare_fn prepare_fn,
599
reflog_expiry_should_prune_fn should_prune_fn,