]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs API: remove OID argument to reflog_expire()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 23 Aug 2021 11:36:11 +0000 (13:36 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Aug 2021 20:27:37 +0000 (13:27 -0700)
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>
builtin/reflog.c
refs.c
refs.h
refs/debug.c
refs/files-backend.c
refs/packed-backend.c
refs/refs-internal.h

index 61795f22d53f3d1ff63d42cda51c95c48e2ba0da..bd4c669918d3d0884c015e9e2650bb65ea507d7a 100644 (file)
@@ -631,7 +631,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                        struct collected_reflog *e = collected.e[i];
 
                        set_reflog_expiry_param(&cb.cmd, explicit_expiry, e->reflog);
-                       status |= reflog_expire(e->reflog, NULL, flags,
+                       status |= reflog_expire(e->reflog, flags,
                                                reflog_expiry_prepare,
                                                should_expire_reflog_ent,
                                                reflog_expiry_cleanup,
@@ -648,7 +648,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                        continue;
                }
                set_reflog_expiry_param(&cb.cmd, explicit_expiry, ref);
-               status |= reflog_expire(ref, NULL, flags,
+               status |= reflog_expire(ref, flags,
                                        reflog_expiry_prepare,
                                        should_expire_reflog_ent,
                                        reflog_expiry_cleanup,
@@ -723,7 +723,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
                        cb.cmd.expire_total = 0;
                }
 
-               status |= reflog_expire(ref, NULL, flags,
+               status |= reflog_expire(ref, flags,
                                        reflog_expiry_prepare,
                                        should_expire_reflog_ent,
                                        reflog_expiry_cleanup,
diff --git a/refs.c b/refs.c
index d963543675992a8195de5eacb8c5dfcd81a8630e..05944d8e72558bd783668fa0f4a5646fb404e041 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -2371,19 +2371,19 @@ int delete_reflog(const char *refname)
 }
 
 int refs_reflog_expire(struct ref_store *refs,
-                      const char *refname, const struct object_id *oid,
+                      const char *refname,
                       unsigned int flags,
                       reflog_expiry_prepare_fn prepare_fn,
                       reflog_expiry_should_prune_fn should_prune_fn,
                       reflog_expiry_cleanup_fn cleanup_fn,
                       void *policy_cb_data)
 {
-       return refs->be->reflog_expire(refs, refname, oid, flags,
+       return refs->be->reflog_expire(refs, refname, flags,
                                       prepare_fn, should_prune_fn,
                                       cleanup_fn, policy_cb_data);
 }
 
-int reflog_expire(const char *refname, const struct object_id *oid,
+int reflog_expire(const char *refname,
                  unsigned int flags,
                  reflog_expiry_prepare_fn prepare_fn,
                  reflog_expiry_should_prune_fn should_prune_fn,
@@ -2391,7 +2391,7 @@ int reflog_expire(const char *refname, const struct object_id *oid,
                  void *policy_cb_data)
 {
        return refs_reflog_expire(get_main_ref_store(the_repository),
-                                 refname, oid, flags,
+                                 refname, flags,
                                  prepare_fn, should_prune_fn,
                                  cleanup_fn, policy_cb_data);
 }
diff --git a/refs.h b/refs.h
index ddbf15f1c2119d3ea9c45873580620698f10f8b4..fda8aef154733eccfdd00aafffa70ec7fc1fe932 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -816,20 +816,19 @@ typedef int reflog_expiry_should_prune_fn(struct object_id *ooid,
 typedef void reflog_expiry_cleanup_fn(void *cb_data);
 
 /*
- * Expire reflog entries for the specified reference. oid is the old
- * value of the reference. flags is a combination of the constants in
+ * Expire reflog entries for the specified reference.
+ * flags is a combination of the constants in
  * enum expire_reflog_flags. The three function pointers are described
  * above. On success, return zero.
  */
 int refs_reflog_expire(struct ref_store *refs,
                       const char *refname,
-                      const struct object_id *oid,
                       unsigned int flags,
                       reflog_expiry_prepare_fn prepare_fn,
                       reflog_expiry_should_prune_fn should_prune_fn,
                       reflog_expiry_cleanup_fn cleanup_fn,
                       void *policy_cb_data);
-int reflog_expire(const char *refname, const struct object_id *oid,
+int reflog_expire(const char *refname,
                  unsigned int flags,
                  reflog_expiry_prepare_fn prepare_fn,
                  reflog_expiry_should_prune_fn should_prune_fn,
index 449ac3e6cc8e68a03723ec0d0b18a9d53101327e..7793c9e1a3d3ac1bd6b6d69f83cc68c359253417 100644 (file)
@@ -391,7 +391,7 @@ static void debug_reflog_expiry_cleanup(void *cb_data)
 }
 
 static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
-                              const struct object_id *oid, unsigned int flags,
+                              unsigned int flags,
                               reflog_expiry_prepare_fn prepare_fn,
                               reflog_expiry_should_prune_fn should_prune_fn,
                               reflog_expiry_cleanup_fn cleanup_fn,
@@ -404,7 +404,7 @@ static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
                .should_prune = should_prune_fn,
                .cb_data = policy_cb_data,
        };
-       int res = drefs->refs->be->reflog_expire(drefs->refs, refname, oid,
+       int res = drefs->refs->be->reflog_expire(drefs->refs, refname,
                                                 flags, &debug_reflog_expiry_prepare,
                                                 &debug_reflog_expiry_should_prune_fn,
                                                 &debug_reflog_expiry_cleanup,
index d81bda8bc25f1f2be16ff2bde59b5e4d694fa0ae..a4adac46443e4dcadfaa33068d6acb9fc1ecaed6 100644 (file)
@@ -3027,7 +3027,7 @@ static int expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
 }
 
 static int files_reflog_expire(struct ref_store *ref_store,
-                              const char *refname, const struct object_id *unused_oid,
+                              const char *refname,
                               unsigned int flags,
                               reflog_expiry_prepare_fn prepare_fn,
                               reflog_expiry_should_prune_fn should_prune_fn,
@@ -3106,7 +3106,6 @@ static int files_reflog_expire(struct ref_store *ref_store,
                }
        }
 
-       assert(!unused_oid);
        (*prepare_fn)(refname, oid, cb.policy_cb);
        refs_for_each_reflog_ent(ref_store, refname, expire_reflog_ent, &cb);
        (*cleanup_fn)(cb.policy_cb);
index 24a360b719ff258717004100e5ad32a38a5f4811..65ba4214b8dd724136bc2df5ee8f7492e924df56 100644 (file)
@@ -1635,7 +1635,7 @@ static int packed_delete_reflog(struct ref_store *ref_store,
 }
 
 static int packed_reflog_expire(struct ref_store *ref_store,
-                               const char *refname, const struct object_id *oid,
+                               const char *refname,
                                unsigned int flags,
                                reflog_expiry_prepare_fn prepare_fn,
                                reflog_expiry_should_prune_fn should_prune_fn,
index 3155708345fcbccdd02f69dd4b155f9b6fd1d098..d496c5ed52dc0a1b0d6ea1fd466af0e9c9e48eb3 100644 (file)
@@ -593,7 +593,7 @@ typedef int create_reflog_fn(struct ref_store *ref_store, const char *refname,
                             int force_create, struct strbuf *err);
 typedef int delete_reflog_fn(struct ref_store *ref_store, const char *refname);
 typedef int reflog_expire_fn(struct ref_store *ref_store,
-                            const char *refname, const struct object_id *oid,
+                            const char *refname,
                             unsigned int flags,
                             reflog_expiry_prepare_fn prepare_fn,
                             reflog_expiry_should_prune_fn should_prune_fn,