Skip to content

Commit 7fdff47

Browse files
pcloudsgitster
authored andcommitted
refs.c: remove the_repo from read_ref_at()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5670090 commit 7fdff47

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

builtin/show-branch.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
753753
/* Ah, that is a date spec... */
754754
timestamp_t at;
755755
at = approxidate(reflog_base);
756-
read_ref_at(ref, flags, at, -1, &oid, NULL,
756+
read_ref_at(get_main_ref_store(the_repository),
757+
ref, flags, at, -1, &oid, NULL,
757758
NULL, NULL, &base);
758759
}
759760
}
@@ -765,7 +766,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
765766
timestamp_t timestamp;
766767
int tz;
767768

768-
if (read_ref_at(ref, flags, 0, base + i, &oid, &logmsg,
769+
if (read_ref_at(get_main_ref_store(the_repository),
770+
ref, flags, 0, base + i, &oid, &logmsg,
769771
&timestamp, &tz, NULL)) {
770772
reflog = i;
771773
break;

refs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,8 @@ static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid
967967
return 1;
968968
}
969969

970-
int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, int cnt,
970+
int read_ref_at(struct ref_store *refs, const char *refname,
971+
unsigned int flags, timestamp_t at_time, int cnt,
971972
struct object_id *oid, char **msg,
972973
timestamp_t *cutoff_time, int *cutoff_tz, int *cutoff_cnt)
973974
{
@@ -983,7 +984,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in
983984
cb.cutoff_cnt = cutoff_cnt;
984985
cb.oid = oid;
985986

986-
for_each_reflog_ent_reverse(refname, read_ref_at_ent, &cb);
987+
refs_for_each_reflog_ent_reverse(refs, refname, read_ref_at_ent, &cb);
987988

988989
if (!cb.reccnt) {
989990
if (flags & GET_OID_QUIETLY)
@@ -994,7 +995,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in
994995
if (cb.found_it)
995996
return 0;
996997

997-
for_each_reflog_ent(refname, read_ref_at_ent_oldest, &cb);
998+
refs_for_each_reflog_ent(refs, refname, read_ref_at_ent_oldest, &cb);
998999

9991000
return 1;
10001001
}

refs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ int refs_create_reflog(struct ref_store *refs, const char *refname,
388388
int safe_create_reflog(const char *refname, int force_create, struct strbuf *err);
389389

390390
/** Reads log for the value of ref during at_time. **/
391-
int read_ref_at(const char *refname, unsigned int flags,
391+
int read_ref_at(struct ref_store *refs,
392+
const char *refname, unsigned int flags,
392393
timestamp_t at_time, int cnt,
393394
struct object_id *oid, char **msg,
394395
timestamp_t *cutoff_time, int *cutoff_tz, int *cutoff_cnt);

sha1-name.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,8 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
849849
return -1;
850850
}
851851
}
852-
if (read_ref_at(real_ref, flags, at_time, nth, oid, NULL,
852+
if (read_ref_at(get_main_ref_store(the_repository),
853+
real_ref, flags, at_time, nth, oid, NULL,
853854
&co_time, &co_tz, &co_cnt)) {
854855
if (!len) {
855856
if (starts_with(real_ref, "refs/heads/")) {

0 commit comments

Comments
 (0)