Skip to content

Commit 0155f71

Browse files
bk2204gitster
authored andcommitted
refs: convert reflog_expire parameter to struct object_id
reflog_expire already used struct object_id internally, but it did not take it as a parameter. Adjust the parameter (and the callers) to pass a pointer to struct object_id instead of a pointer to unsigned char. Remove the temporary inserted earlier as it is no longer required. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8eb36d9 commit 0155f71

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

builtin/reflog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
589589
for (i = 0; i < collected.nr; i++) {
590590
struct collected_reflog *e = collected.e[i];
591591
set_reflog_expiry_param(&cb.cmd, explicit_expiry, e->reflog);
592-
status |= reflog_expire(e->reflog, e->oid.hash, flags,
592+
status |= reflog_expire(e->reflog, &e->oid, flags,
593593
reflog_expiry_prepare,
594594
should_expire_reflog_ent,
595595
reflog_expiry_cleanup,
@@ -607,7 +607,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
607607
continue;
608608
}
609609
set_reflog_expiry_param(&cb.cmd, explicit_expiry, ref);
610-
status |= reflog_expire(ref, oid.hash, flags,
610+
status |= reflog_expire(ref, &oid, flags,
611611
reflog_expiry_prepare,
612612
should_expire_reflog_ent,
613613
reflog_expiry_cleanup,
@@ -683,7 +683,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
683683
cb.cmd.expire_total = 0;
684684
}
685685

686-
status |= reflog_expire(ref, oid.hash, flags,
686+
status |= reflog_expire(ref, &oid, flags,
687687
reflog_expiry_prepare,
688688
should_expire_reflog_ent,
689689
reflog_expiry_cleanup,

refs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,27 +2010,27 @@ int delete_reflog(const char *refname)
20102010
}
20112011

20122012
int refs_reflog_expire(struct ref_store *refs,
2013-
const char *refname, const unsigned char *sha1,
2013+
const char *refname, const struct object_id *oid,
20142014
unsigned int flags,
20152015
reflog_expiry_prepare_fn prepare_fn,
20162016
reflog_expiry_should_prune_fn should_prune_fn,
20172017
reflog_expiry_cleanup_fn cleanup_fn,
20182018
void *policy_cb_data)
20192019
{
2020-
return refs->be->reflog_expire(refs, refname, sha1, flags,
2020+
return refs->be->reflog_expire(refs, refname, oid, flags,
20212021
prepare_fn, should_prune_fn,
20222022
cleanup_fn, policy_cb_data);
20232023
}
20242024

2025-
int reflog_expire(const char *refname, const unsigned char *sha1,
2025+
int reflog_expire(const char *refname, const struct object_id *oid,
20262026
unsigned int flags,
20272027
reflog_expiry_prepare_fn prepare_fn,
20282028
reflog_expiry_should_prune_fn should_prune_fn,
20292029
reflog_expiry_cleanup_fn cleanup_fn,
20302030
void *policy_cb_data)
20312031
{
20322032
return refs_reflog_expire(get_main_ref_store(),
2033-
refname, sha1, flags,
2033+
refname, oid, flags,
20342034
prepare_fn, should_prune_fn,
20352035
cleanup_fn, policy_cb_data);
20362036
}

refs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,20 +703,20 @@ typedef int reflog_expiry_should_prune_fn(struct object_id *ooid,
703703
typedef void reflog_expiry_cleanup_fn(void *cb_data);
704704

705705
/*
706-
* Expire reflog entries for the specified reference. sha1 is the old
706+
* Expire reflog entries for the specified reference. oid is the old
707707
* value of the reference. flags is a combination of the constants in
708708
* enum expire_reflog_flags. The three function pointers are described
709709
* above. On success, return zero.
710710
*/
711711
int refs_reflog_expire(struct ref_store *refs,
712712
const char *refname,
713-
const unsigned char *sha1,
713+
const struct object_id *oid,
714714
unsigned int flags,
715715
reflog_expiry_prepare_fn prepare_fn,
716716
reflog_expiry_should_prune_fn should_prune_fn,
717717
reflog_expiry_cleanup_fn cleanup_fn,
718718
void *policy_cb_data);
719-
int reflog_expire(const char *refname, const unsigned char *sha1,
719+
int reflog_expire(const char *refname, const struct object_id *oid,
720720
unsigned int flags,
721721
reflog_expiry_prepare_fn prepare_fn,
722722
reflog_expiry_should_prune_fn should_prune_fn,

refs/files-backend.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2908,7 +2908,7 @@ static int expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
29082908
}
29092909

29102910
static int files_reflog_expire(struct ref_store *ref_store,
2911-
const char *refname, const unsigned char *sha1,
2911+
const char *refname, const struct object_id *oid,
29122912
unsigned int flags,
29132913
reflog_expiry_prepare_fn prepare_fn,
29142914
reflog_expiry_should_prune_fn should_prune_fn,
@@ -2925,7 +2925,6 @@ static int files_reflog_expire(struct ref_store *ref_store,
29252925
int status = 0;
29262926
int type;
29272927
struct strbuf err = STRBUF_INIT;
2928-
struct object_id oid;
29292928

29302929
memset(&cb, 0, sizeof(cb));
29312930
cb.flags = flags;
@@ -2937,7 +2936,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
29372936
* reference itself, plus we might need to update the
29382937
* reference if --updateref was specified:
29392938
*/
2940-
lock = lock_ref_sha1_basic(refs, refname, sha1,
2939+
lock = lock_ref_sha1_basic(refs, refname, oid->hash,
29412940
NULL, NULL, REF_NODEREF,
29422941
&type, &err);
29432942
if (!lock) {
@@ -2975,9 +2974,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
29752974
}
29762975
}
29772976

2978-
hashcpy(oid.hash, sha1);
2979-
2980-
(*prepare_fn)(refname, &oid, cb.policy_cb);
2977+
(*prepare_fn)(refname, oid, cb.policy_cb);
29812978
refs_for_each_reflog_ent(ref_store, refname, expire_reflog_ent, &cb);
29822979
(*cleanup_fn)(cb.policy_cb);
29832980

refs/packed-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ static int packed_delete_reflog(struct ref_store *ref_store,
15191519
}
15201520

15211521
static int packed_reflog_expire(struct ref_store *ref_store,
1522-
const char *refname, const unsigned char *sha1,
1522+
const char *refname, const struct object_id *oid,
15231523
unsigned int flags,
15241524
reflog_expiry_prepare_fn prepare_fn,
15251525
reflog_expiry_should_prune_fn should_prune_fn,

refs/refs-internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ typedef int create_reflog_fn(struct ref_store *ref_store, const char *refname,
608608
int force_create, struct strbuf *err);
609609
typedef int delete_reflog_fn(struct ref_store *ref_store, const char *refname);
610610
typedef int reflog_expire_fn(struct ref_store *ref_store,
611-
const char *refname, const unsigned char *sha1,
611+
const char *refname, const struct object_id *oid,
612612
unsigned int flags,
613613
reflog_expiry_prepare_fn prepare_fn,
614614
reflog_expiry_should_prune_fn should_prune_fn,

0 commit comments

Comments
 (0)